Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 026ab6f

Browse files
authored
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.
1 parent b2714f0 commit 026ab6f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Include/object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,11 +511,11 @@ PyAPI_FUNC(void) _Py_DecRef(PyObject *);
511511

512512
static inline void Py_INCREF(PyObject *op)
513513
{
514-
_Py_INCREF_STAT_INC();
515514
#if defined(Py_REF_DEBUG) && defined(Py_LIMITED_API) && Py_LIMITED_API+0 >= 0x030A0000
516515
// Stable ABI for Python 3.10 built in debug mode.
517516
_Py_IncRef(op);
518517
#else
518+
_Py_INCREF_STAT_INC();
519519
// Non-limited C API and limited C API for Python 3.9 and older access
520520
// directly PyObject.ob_refcnt.
521521
#ifdef Py_REF_DEBUG

0 commit comments

Comments
 (0)