https://github.com/python/cpython/commit/95f62969bb22a8b14f403818c1078567260ed344 commit: 95f62969bb22a8b14f403818c1078567260ed344 branch: 3.13 author: Victor Stinner <vstin...@python.org> committer: vstinner <vstin...@python.org> date: 2025-06-04T17:10:51+02:00 summary:
[3.13] gh-134989: Implement PyObject_DelAttr() as a macro in the limited C API (GH-135021) (#135134) gh-134989: Implement PyObject_DelAttr() as a macro in the limited C API (GH-135021) (cherry picked from commit c21113072cd1f0da83729f99d3576647db85d816) files: A Misc/NEWS.d/next/C API/2025-06-02-13-19-22.gh-issue-134989.sDDyBN.rst M Include/abstract.h diff --git a/Include/abstract.h b/Include/abstract.h index bd12a54963c13f..98e1bbe4100fc7 100644 --- a/Include/abstract.h +++ b/Include/abstract.h @@ -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: diff --git a/Misc/NEWS.d/next/C API/2025-06-02-13-19-22.gh-issue-134989.sDDyBN.rst b/Misc/NEWS.d/next/C API/2025-06-02-13-19-22.gh-issue-134989.sDDyBN.rst new file mode 100644 index 00000000000000..e49f765106582e --- /dev/null +++ b/Misc/NEWS.d/next/C API/2025-06-02-13-19-22.gh-issue-134989.sDDyBN.rst @@ -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. _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: arch...@mail-archive.com