diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-06-14 01:05:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-14 01:05:01 (GMT) |
commit | 26bc2cc06128890ac89492eca20e83abe0789c1c (patch) | |
tree | 316296f4c6994a1113a1abe49afb45e733498226 /Include | |
parent | 33d3069c45bda38f52053a115e3c0810cd631dd6 (diff) | |
download | cpython-26bc2cc06128890ac89492eca20e83abe0789c1c.zip cpython-26bc2cc06128890ac89492eca20e83abe0789c1c.tar.gz cpython-26bc2cc06128890ac89492eca20e83abe0789c1c.tar.bz2 |
[3.12] gh-105387: Limited C API implements Py_INCREF() as func (GH-105388) (#105763)
gh-105387: Limited C API implements Py_INCREF() as func (GH-105388)
In the limited C API version 3.12, Py_INCREF() and Py_DECREF()
functions are now implemented as opaque function calls to hide
implementation details.
(cherry picked from commit b542972dc133973a7f0517aa1b61779271789111)
Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Include')
-rw-r--r-- | Include/object.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Include/object.h b/Include/object.h index ad16b72c..3ef6451 100644 --- a/Include/object.h +++ b/Include/object.h @@ -610,10 +610,11 @@ PyAPI_FUNC(void) _Py_DecRef(PyObject *); static inline Py_ALWAYS_INLINE void Py_INCREF(PyObject *op) { -#if defined(Py_REF_DEBUG) && defined(Py_LIMITED_API) - // Stable ABI for Python built in debug mode. _Py_IncRef() was added to - // Python 3.10.0a7, use Py_IncRef() on older Python versions. Py_IncRef() - // accepts NULL whereas _Py_IncRef() doesn't. +#if defined(Py_LIMITED_API) && (Py_LIMITED_API+0 >= 0x030c0000 || defined(Py_REF_DEBUG)) + // Stable ABI implements Py_INCREF() as a function call on limited C API + // version 3.12 and newer, and on Python built in debug mode. _Py_IncRef() + // was added to Python 3.10.0a7, use Py_IncRef() on older Python versions. + // Py_IncRef() accepts NULL whereas _Py_IncRef() doesn't. # if Py_LIMITED_API+0 >= 0x030a00A7 _Py_IncRef(op); # else @@ -647,10 +648,11 @@ static inline Py_ALWAYS_INLINE void Py_INCREF(PyObject *op) # define Py_INCREF(op) Py_INCREF(_PyObject_CAST(op)) #endif -#if defined(Py_REF_DEBUG) && defined(Py_LIMITED_API) -// Stable ABI for Python built in debug mode. _Py_DecRef() was added to Python -// 3.10.0a7, use Py_DecRef() on older Python versions. Py_DecRef() accepts NULL -// whereas _Py_IncRef() doesn't. +#if defined(Py_LIMITED_API) && (Py_LIMITED_API+0 >= 0x030c0000 || defined(Py_REF_DEBUG)) +// Stable ABI implements Py_DECREF() as a function call on limited C API +// version 3.12 and newer, and on Python built in debug mode. _Py_DecRef() was +// added to Python 3.10.0a7, use Py_DecRef() on older Python versions. +// Py_DecRef() accepts NULL whereas _Py_IncRef() doesn't. static inline void Py_DECREF(PyObject *op) { # if Py_LIMITED_API+0 >= 0x030a00A7 _Py_DecRef(op); |