function,PyObject_CheckBuffer,3.11,,
function,PyObject_ClearWeakRefs,3.2,,
function,PyObject_CopyData,3.11,,
+function,PyObject_DelAttr,3.13,,
+function,PyObject_DelAttrString,3.13,,
function,PyObject_DelItem,3.2,,
function,PyObject_DelItemString,3.2,,
function,PyObject_Dir,3.2,,
This is the equivalent of the Python statement o.attr_name=v. */
-/* Implemented as a macro:
+/* Implemented elsewhere:
int PyObject_DelAttrString(PyObject *o, const char *attr_name);
-1 on failure.
This is the equivalent of the Python statement: del o.attr_name. */
-#define PyObject_DelAttrString(O, A) PyObject_SetAttrString((O), (A), NULL)
-/* Implemented as a macro:
+/* Implemented elsewhere:
int PyObject_DelAttr(PyObject *o, PyObject *attr_name);
Delete attribute named attr_name, for object o. Returns -1
on failure. This is the equivalent of the Python
statement: del o.attr_name. */
-#define PyObject_DelAttr(O, A) PyObject_SetAttr((O), (A), NULL)
/* Implemented elsewhere:
PyAPI_FUNC(int) PyObject_RichCompareBool(PyObject *, PyObject *, int);
PyAPI_FUNC(PyObject *) PyObject_GetAttrString(PyObject *, const char *);
PyAPI_FUNC(int) PyObject_SetAttrString(PyObject *, const char *, PyObject *);
+PyAPI_FUNC(int) PyObject_DelAttrString(PyObject *v, const char *name);
PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, const char *);
PyAPI_FUNC(PyObject *) PyObject_GetAttr(PyObject *, PyObject *);
PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *);
+PyAPI_FUNC(int) PyObject_DelAttr(PyObject *v, PyObject *name);
PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyObject_SelfIter(PyObject *);
PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *);
"PyObject_CheckReadBuffer",
"PyObject_ClearWeakRefs",
"PyObject_CopyData",
+ "PyObject_DelAttr",
+ "PyObject_DelAttrString",
"PyObject_DelItem",
"PyObject_DelItemString",
"PyObject_Dir",
--- /dev/null
+Convert :c:func:`PyObject_DelAttr` and :c:func:`PyObject_DelAttrString`
+macros to functions. Patch by Victor Stinner.
added = '3.13'
[function.PyWeakref_GetRef]
added = '3.13'
+[function.PyObject_DelAttr]
+ added = '3.13'
+[function.PyObject_DelAttrString]
+ added = '3.13'
return res;
}
+int
+PyObject_DelAttrString(PyObject *v, const char *name)
+{
+ return PyObject_SetAttrString(v, name, NULL);
+}
+
int
_PyObject_IsAbstract(PyObject *obj)
{
return -1;
}
+int
+PyObject_DelAttr(PyObject *v, PyObject *name)
+{
+ return PyObject_SetAttr(v, name, NULL);
+}
+
PyObject **
_PyObject_ComputedDictPointer(PyObject *obj)
{
EXPORT_FUNC(PyObject_CheckReadBuffer)
EXPORT_FUNC(PyObject_ClearWeakRefs)
EXPORT_FUNC(PyObject_CopyData)
+EXPORT_FUNC(PyObject_DelAttr)
+EXPORT_FUNC(PyObject_DelAttrString)
EXPORT_FUNC(PyObject_DelItem)
EXPORT_FUNC(PyObject_DelItemString)
EXPORT_FUNC(PyObject_Dir)
builtin_delattr_impl(PyObject *module, PyObject *obj, PyObject *name)
/*[clinic end generated code: output=85134bc58dff79fa input=164865623abe7216]*/
{
- if (PyObject_SetAttr(obj, name, (PyObject *)NULL) != 0)
+ if (PyObject_DelAttr(obj, name) < 0) {
return NULL;
+ }
Py_RETURN_NONE;
}
inst(DELETE_ATTR, (owner --)) {
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
- int err = PyObject_SetAttr(owner, name, (PyObject *)NULL);
+ int err = PyObject_DelAttr(owner, name);
DECREF_INPUTS();
ERROR_IF(err, error);
}
PyObject *owner = stack_pointer[-1];
#line 1242 "Python/bytecodes.c"
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
- int err = PyObject_SetAttr(owner, name, (PyObject *)NULL);
+ int err = PyObject_DelAttr(owner, name);
#line 1023 "Python/executor_cases.c.h"
Py_DECREF(owner);
#line 1245 "Python/bytecodes.c"
PyObject *owner = stack_pointer[-1];
#line 1242 "Python/bytecodes.c"
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
- int err = PyObject_SetAttr(owner, name, (PyObject *)NULL);
+ int err = PyObject_DelAttr(owner, name);
#line 1701 "Python/generated_cases.c.h"
Py_DECREF(owner);
#line 1245 "Python/bytecodes.c"