Skip to content

Commit 41fbcd3

Browse files
committed
gh-134989: Implement PyObject_DelAttr() as a macro in the limited C API
1 parent 5f61cde commit 41fbcd3

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Include/abstract.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,12 @@ extern "C" {
147147
148148
Delete attribute named attr_name, for object o. Returns -1
149149
on failure. This is the equivalent of the Python
150-
statement: del o.attr_name. */
150+
statement: del o.attr_name.
151+
152+
Implemented as a macro in the limited C API 3.12 and older. */
153+
#if defined(Py_LIMITED_API) && Py_LIMITED_API+0 < 0x030d0000
154+
# define PyObject_DelAttr(O, A) PyObject_SetAttr((O), (A), NULL)
155+
#endif
151156

152157

153158
/* Implemented elsewhere:
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Implement :c:func:`PyObject_DelAttr` as a macro in the limited C API 3.12
2+
and older. Patch by Victor Stinner.

0 commit comments

Comments
 (0)