[3.14] gh-134989: Implement PyObject_DelAttr() as a macro in the limited C API (GH-135021) (#135133)

gh-134989: Implement PyObject_DelAttr() as a macro in the limited C API (GH-135021)
(cherry picked from commit c21113072c)

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Miss Islington (bot) 2025-06-04 15:33:20 +02:00 committed by GitHub
parent 3b01be24e7
commit da1bbce4ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 2 deletions

View file

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

View file

@ -0,0 +1,2 @@
Implement :c:func:`PyObject_DelAttr` and :c:func:`PyObject_DelAttrString` as
macros in the limited C API 3.12 and older. Patch by Victor Stinner.