mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-39542: Simplify _Py_NewReference() (GH-18332)
* Remove _Py_INC_REFTOTAL and _Py_DEC_REFTOTAL macros: modify directly _Py_RefTotal. * _Py_ForgetReference() is no longer defined if the Py_TRACE_REFS macro is not defined. * Remove _Py_NewReference() implementation from object.c: unify the two implementations in object.h inline function. * Fix Py_TRACE_REFS build: _Py_INC_TPALLOCS() macro has been removed.
This commit is contained in:
parent
24e5ad4689
commit
49932fec62
7 changed files with 60 additions and 58 deletions
|
@ -902,10 +902,15 @@ _PyTuple_Resize(PyObject **pv, Py_ssize_t newsize)
|
|||
}
|
||||
|
||||
/* XXX UNREF/NEWREF interface should be more symmetrical */
|
||||
_Py_DEC_REFTOTAL;
|
||||
if (_PyObject_GC_IS_TRACKED(v))
|
||||
#ifdef Py_REF_DEBUG
|
||||
_Py_RefTotal--;
|
||||
#endif
|
||||
if (_PyObject_GC_IS_TRACKED(v)) {
|
||||
_PyObject_GC_UNTRACK(v);
|
||||
}
|
||||
#ifdef Py_TRACE_REFS
|
||||
_Py_ForgetReference((PyObject *) v);
|
||||
#endif
|
||||
/* DECREF items deleted by shrinkage */
|
||||
for (i = newsize; i < oldsize; i++) {
|
||||
Py_CLEAR(v->ob_item[i]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue