summaryrefslogtreecommitdiff
path: root/Objects/bytesobject.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-02-03 17:55:05 +0100
committerGitHub <noreply@github.com>2020-02-03 17:55:04 +0100
commit49932fec62c616ec88da52642339d83ae719e924 (patch)
treeb489d2b97cf56c0b51a15f27ecf4064c5084d9d8 /Objects/bytesobject.c
parent24e5ad4689de9adc8e4a7d8c08fe400dcea668e6 (diff)
downloadcpython-git-49932fec62c616ec88da52642339d83ae719e924.tar.gz
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/bytesobject.c')
-rw-r--r--Objects/bytesobject.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index 00151b8256..5334eca7f3 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -2948,8 +2948,12 @@ _PyBytes_Resize(PyObject **pv, Py_ssize_t newsize)
return (*pv == NULL) ? -1 : 0;
}
/* XXX UNREF/NEWREF interface should be more symmetrical */
- _Py_DEC_REFTOTAL;
+#ifdef Py_REF_DEBUG
+ _Py_RefTotal--;
+#endif
+#ifdef Py_TRACE_REFS
_Py_ForgetReference(v);
+#endif
*pv = (PyObject *)
PyObject_REALLOC(v, PyBytesObject_SIZE + newsize);
if (*pv == NULL) {