summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-07-11 09:38:22 (GMT)
committerGitHub <noreply@github.com>2023-07-11 09:38:22 (GMT)
commit1f2921b72c369b19c2e32aaedb9f8c63e0cb8b48 (patch)
tree36a45c5f49093ad3a7947593f2d35901c021f3cb /Include
parente6379f72cbc60f6b3c5676f9e225d4f145d5693f (diff)
downloadcpython-1f2921b72c369b19c2e32aaedb9f8c63e0cb8b48.zip
cpython-1f2921b72c369b19c2e32aaedb9f8c63e0cb8b48.tar.gz
cpython-1f2921b72c369b19c2e32aaedb9f8c63e0cb8b48.tar.bz2
gh-106572: Convert PyObject_DelAttr() to a function (#106611)
* Convert PyObject_DelAttr() and PyObject_DelAttrString() macros to functions. * Add PyObject_DelAttr() and PyObject_DelAttrString() functions to the stable ABI. * Replace PyObject_SetAttr(obj, name, NULL) with PyObject_DelAttr(obj, name).
Diffstat (limited to 'Include')
-rw-r--r--Include/abstract.h6
-rw-r--r--Include/object.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/Include/abstract.h b/Include/abstract.h
index 016ace9..c84d2c7 100644
--- a/Include/abstract.h
+++ b/Include/abstract.h
@@ -80,7 +80,7 @@ extern "C" {
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);
@@ -88,17 +88,15 @@ extern "C" {
-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:
diff --git a/Include/object.h b/Include/object.h
index 3ef6451..dccab07 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -391,9 +391,11 @@ PyAPI_FUNC(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int);
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 *);