mirror of
https://github.com/python/cpython.git
synced 2025-07-12 05:45:15 +00: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
|
@ -947,21 +947,18 @@ resize_compact(PyObject *unicode, Py_ssize_t length)
|
|||
_PyUnicode_UTF8(unicode) = NULL;
|
||||
_PyUnicode_UTF8_LENGTH(unicode) = 0;
|
||||
}
|
||||
#ifdef Py_REF_DEBUG
|
||||
_Py_RefTotal--;
|
||||
#endif
|
||||
#ifdef Py_TRACE_REFS
|
||||
_Py_ForgetReference(unicode);
|
||||
#endif
|
||||
|
||||
new_unicode = (PyObject *)PyObject_Realloc(unicode, new_size);
|
||||
if (new_unicode == NULL) {
|
||||
_Py_NewReference(unicode);
|
||||
_Py_NewReferenceNoTotal(unicode);
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
unicode = new_unicode;
|
||||
_Py_NewReference(unicode);
|
||||
_Py_NewReferenceNoTotal(unicode);
|
||||
|
||||
_PyUnicode_LENGTH(unicode) = length;
|
||||
#ifdef Py_DEBUG
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue