@@ -610,10 +610,11 @@ PyAPI_FUNC(void) _Py_DecRef(PyObject *);
610
610
611
611
static inline Py_ALWAYS_INLINE void Py_INCREF (PyObject * op )
612
612
{
613
- #if defined(Py_REF_DEBUG ) && defined(Py_LIMITED_API )
614
- // Stable ABI for Python built in debug mode. _Py_IncRef() was added to
615
- // Python 3.10.0a7, use Py_IncRef() on older Python versions. Py_IncRef()
616
- // accepts NULL whereas _Py_IncRef() doesn't.
613
+ #if defined(Py_LIMITED_API ) && (Py_LIMITED_API + 0 >= 0x030c0000 || defined(Py_REF_DEBUG ))
614
+ // Stable ABI implements Py_INCREF() as a function call on limited C API
615
+ // version 3.12 and newer, and on Python built in debug mode. _Py_IncRef()
616
+ // was added to Python 3.10.0a7, use Py_IncRef() on older Python versions.
617
+ // Py_IncRef() accepts NULL whereas _Py_IncRef() doesn't.
617
618
# if Py_LIMITED_API + 0 >= 0x030a00A7
618
619
_Py_IncRef (op );
619
620
# else
@@ -647,10 +648,11 @@ static inline Py_ALWAYS_INLINE void Py_INCREF(PyObject *op)
647
648
# define Py_INCREF (op ) Py_INCREF(_PyObject_CAST(op))
648
649
#endif
649
650
650
- #if defined(Py_REF_DEBUG ) && defined(Py_LIMITED_API )
651
- // Stable ABI for Python built in debug mode. _Py_DecRef() was added to Python
652
- // 3.10.0a7, use Py_DecRef() on older Python versions. Py_DecRef() accepts NULL
653
- // whereas _Py_IncRef() doesn't.
651
+ #if defined(Py_LIMITED_API ) && (Py_LIMITED_API + 0 >= 0x030c0000 || defined(Py_REF_DEBUG ))
652
+ // Stable ABI implements Py_DECREF() as a function call on limited C API
653
+ // version 3.12 and newer, and on Python built in debug mode. _Py_DecRef() was
654
+ // added to Python 3.10.0a7, use Py_DecRef() on older Python versions.
655
+ // Py_DecRef() accepts NULL whereas _Py_IncRef() doesn't.
654
656
static inline void Py_DECREF (PyObject * op ) {
655
657
# if Py_LIMITED_API + 0 >= 0x030a00A7
656
658
_Py_DecRef (op );
0 commit comments