summaryrefslogtreecommitdiffstats
path: root/Objects/tupleobject.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-02-03 16:55:05 (GMT)
committerGitHub <noreply@github.com>2020-02-03 16:55:04 (GMT)
commit49932fec62c616ec88da52642339d83ae719e924 (patch)
treeb489d2b97cf56c0b51a15f27ecf4064c5084d9d8 /Objects/tupleobject.c
parent24e5ad4689de9adc8e4a7d8c08fe400dcea668e6 (diff)
downloadcpython-49932fec62c616ec88da52642339d83ae719e924.zip
cpython-49932fec62c616ec88da52642339d83ae719e924.tar.gz
cpython-49932fec62c616ec88da52642339d83ae719e924.tar.bz2
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.
Diffstat (limited to 'Objects/tupleobject.c')
-rw-r--r--Objects/tupleobject.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index 2708b9a..8c8c66f 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -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]);