summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-08-29 12:55:46 (GMT)
committerGitHub <noreply@github.com>2022-08-29 12:55:46 (GMT)
commit026ab6f4e50658b798be8d1ccf4f3005966e33ea (patch)
tree952596e5be0ec289063034b0825c21f03f0ddcf7
parentb2714f05c5cc8765178f296f0f8043410e3a5584 (diff)
downloadcpython-026ab6f4e50658b798be8d1ccf4f3005966e33ea.zip
cpython-026ab6f4e50658b798be8d1ccf4f3005966e33ea.tar.gz
cpython-026ab6f4e50658b798be8d1ccf4f3005966e33ea.tar.bz2
Fix Py_INCREF() statistics in limited C API 3.10 (#96120)
In the limited C API with a debug build, Py_INCREF() is implemented by calling _Py_IncRef() which calls Py_INCREF(). Only call _Py_INCREF_STAT_INC() once.
-rw-r--r--Include/object.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/Include/object.h b/Include/object.h
index 21d3a75..75624fe 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -511,11 +511,11 @@ PyAPI_FUNC(void) _Py_DecRef(PyObject *);
static inline void Py_INCREF(PyObject *op)
{
- _Py_INCREF_STAT_INC();
#if defined(Py_REF_DEBUG) && defined(Py_LIMITED_API) && Py_LIMITED_API+0 >= 0x030A0000
// Stable ABI for Python 3.10 built in debug mode.
_Py_IncRef(op);
#else
+ _Py_INCREF_STAT_INC();
// Non-limited C API and limited C API for Python 3.9 and older access
// directly PyObject.ob_refcnt.
#ifdef Py_REF_DEBUG