Skip to content

Commit c211130

Browse files
authored
gh-134989: Implement PyObject_DelAttr() as a macro in the limited C API (GH-135021)
1 parent 40c8be0 commit c211130

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

Include/abstract.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,12 @@ extern "C" {
138138
Delete attribute named attr_name, for object o. Returns
139139
-1 on failure.
140140
141-
This is the equivalent of the Python statement: del o.attr_name. */
141+
This is the equivalent of the Python statement: del o.attr_name.
142+
143+
Implemented as a macro in the limited C API 3.12 and older. */
144+
#if defined(Py_LIMITED_API) && Py_LIMITED_API+0 < 0x030d0000
145+
# define PyObject_DelAttrString(O, A) PyObject_SetAttrString((O), (A), NULL)
146+
#endif
142147

143148

144149
/* Implemented elsewhere:
@@ -147,7 +152,12 @@ extern "C" {
147152
148153
Delete attribute named attr_name, for object o. Returns -1
149154
on failure. This is the equivalent of the Python
150-
statement: del o.attr_name. */
155+
statement: del o.attr_name.
156+
157+
Implemented as a macro in the limited C API 3.12 and older. */
158+
#if defined(Py_LIMITED_API) && Py_LIMITED_API+0 < 0x030d0000
159+
# define PyObject_DelAttr(O, A) PyObject_SetAttr((O), (A), NULL)
160+
#endif
151161

152162

153163
/* 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` and :c:func:`PyObject_DelAttrString` as
2+
macros in the limited C API 3.12 and older. Patch by Victor Stinner.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy