diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2023-03-08 19:03:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-08 19:03:50 (GMT) |
commit | cbb0aa71d040022db61390380b8aebc7c04f3275 (patch) | |
tree | 9ff9e2f3141fbd5bdc2446144955722a7d63afa9 /Objects/bytesobject.c | |
parent | 11a2c6ce516b24b2435cb627742a6c4df92d411c (diff) | |
download | cpython-cbb0aa71d040022db61390380b8aebc7c04f3275.zip cpython-cbb0aa71d040022db61390380b8aebc7c04f3275.tar.gz cpython-cbb0aa71d040022db61390380b8aebc7c04f3275.tar.bz2 |
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
Diffstat (limited to 'Objects/bytesobject.c')
-rw-r--r-- | Objects/bytesobject.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 657443f..687a654 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -3060,21 +3060,20 @@ _PyBytes_Resize(PyObject **pv, Py_ssize_t newsize) Py_DECREF(v); return 0; } - /* XXX UNREF/NEWREF interface should be more symmetrical */ -#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) { +#ifdef Py_REF_DEBUG + _Py_DecRefTotal(); +#endif PyObject_Free(v); PyErr_NoMemory(); return -1; } - _Py_NewReference(*pv); + _Py_NewReferenceNoTotal(*pv); sv = (PyBytesObject *) *pv; Py_SET_SIZE(sv, newsize); sv->ob_sval[newsize] = '\0'; |