mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
gh-102304: Consolidate Direct Usage of _Py_RefTotal (gh-102514)
This simplifies further changes to _Py_RefTotal (e.g. make it atomic or move it to PyInterpreterState). https://github.com/python/cpython/issues/102304
This commit is contained in:
parent
11a2c6ce51
commit
cbb0aa71d0
10 changed files with 127 additions and 45 deletions
|
|
@ -1654,15 +1654,10 @@ slot_tp_del(PyObject *self)
|
|||
*/
|
||||
{
|
||||
Py_ssize_t refcnt = Py_REFCNT(self);
|
||||
_Py_NewReference(self);
|
||||
_Py_NewReferenceNoTotal(self);
|
||||
Py_SET_REFCNT(self, refcnt);
|
||||
}
|
||||
assert(!PyType_IS_GC(Py_TYPE(self)) || PyObject_GC_IsTracked(self));
|
||||
/* If Py_REF_DEBUG macro is defined, _Py_NewReference() increased
|
||||
_Py_RefTotal, so we need to undo that. */
|
||||
#ifdef Py_REF_DEBUG
|
||||
_Py_RefTotal--;
|
||||
#endif
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue