:file:`!configure`.
(Contributed by Christian Heimes in :gh:`89886`.)
+* C extensions built with the :ref:`limited C API <limited-c-api>`
+ on :ref:`Python build in debug mode <debug-build>` no longer support Python
+ 3.9 and older. In this configuration, :c:func:`Py_INCREF` and
+ :c:func:`Py_DECREF` are now always implemented as opaque function calls,
+ but the called functions were added to Python 3.10. Build C extensions
+ with a release build of Python or with Python 3.12 and older, to keep support
+ for Python 3.9 and older.
+ (Contributed by Victor Stinner in :gh:`102304`.)
+
C API Changes
=============
you can count such references to the type object.)
*/
-#ifdef Py_REF_DEBUG
-# if defined(Py_LIMITED_API) && Py_LIMITED_API+0 < 0x030A0000
-extern Py_ssize_t _Py_RefTotal;
-# define _Py_INC_REFTOTAL() _Py_RefTotal++
-# define _Py_DEC_REFTOTAL() _Py_RefTotal--
-# elif !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030C0000
+#if defined(Py_REF_DEBUG) && !defined(Py_LIMITED_API)
+PyAPI_FUNC(void) _Py_NegativeRefcount(const char *filename, int lineno,
+ PyObject *op);
PyAPI_FUNC(void) _Py_IncRefTotal_DO_NOT_USE_THIS(void);
PyAPI_FUNC(void) _Py_DecRefTotal_DO_NOT_USE_THIS(void);
# define _Py_INC_REFTOTAL() _Py_IncRefTotal_DO_NOT_USE_THIS()
# define _Py_DEC_REFTOTAL() _Py_DecRefTotal_DO_NOT_USE_THIS()
-# endif
-PyAPI_FUNC(void) _Py_NegativeRefcount(const char *filename, int lineno,
- PyObject *op);
-#endif /* Py_REF_DEBUG */
+#endif // Py_REF_DEBUG && !Py_LIMITED_API
PyAPI_FUNC(void) _Py_Dealloc(PyObject *);
static inline Py_ALWAYS_INLINE void Py_INCREF(PyObject *op)
{
-#if defined(Py_REF_DEBUG) && defined(Py_LIMITED_API) && Py_LIMITED_API+0 >= 0x030A0000
- // Stable ABI for Python 3.10 built in debug mode.
+#if defined(Py_REF_DEBUG) && defined(Py_LIMITED_API)
+ // Stable ABI for Python built in debug mode
_Py_IncRef(op);
#else
// Non-limited C API and limited C API for Python 3.9 and older access
# define Py_INCREF(op) Py_INCREF(_PyObject_CAST(op))
#endif
-#if defined(Py_REF_DEBUG) && defined(Py_LIMITED_API) && Py_LIMITED_API+0 >= 0x030A0000
-// Stable ABI for limited C API version 3.10 of Python debug build
+#if defined(Py_REF_DEBUG) && defined(Py_LIMITED_API)
+// Stable ABI for Python built in debug mode
static inline void Py_DECREF(PyObject *op) {
_Py_DecRef(op);
}
EXPORT_FUNC(_Py_CheckRecursiveCall)
EXPORT_FUNC(_Py_Dealloc)
EXPORT_FUNC(_Py_DecRef)
-EXPORT_FUNC(_Py_DecRefTotal_DO_NOT_USE_THIS)
EXPORT_FUNC(_Py_IncRef)
-EXPORT_FUNC(_Py_IncRefTotal_DO_NOT_USE_THIS)
EXPORT_FUNC(_Py_NegativeRefcount)
EXPORT_FUNC(_Py_VaBuildValue_SizeT)
EXPORT_FUNC(_PyArg_Parse_SizeT)