mirror of
https://github.com/python/cpython.git
synced 2025-08-23 18:24:46 +00:00
[3.12] gh-127599: Fix _Py_RefcntAdd missing calls to _Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC (GH-127717) (#128712)
Previously, `_Py_RefcntAdd` hasn't called
`_Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC` which is incorrect.
Now it has been fixed.
(cherry picked from commit ab05beb8ce
)
This commit is contained in:
parent
3d9b14c19b
commit
bca489076f
2 changed files with 7 additions and 0 deletions
|
@ -65,6 +65,11 @@ static inline void _Py_RefcntAdd(PyObject* op, Py_ssize_t n)
|
|||
_Py_AddRefTotal(_PyInterpreterState_GET(), n);
|
||||
#endif
|
||||
op->ob_refcnt += n;
|
||||
|
||||
// Although the ref count was increased by `n` (which may be greater than 1)
|
||||
// it is only a single increment (i.e. addition) operation, so only 1 refcnt
|
||||
// increment operation is counted.
|
||||
_Py_INCREF_STAT_INC();
|
||||
}
|
||||
#define _Py_RefcntAdd(op, n) _Py_RefcntAdd(_PyObject_CAST(op), n)
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Fix statistics for increments of object reference counts (in particular, when
|
||||
a reference count was increased by more than 1 in a single operation).
|
Loading…
Add table
Add a link
Reference in a new issue