diff options
author | Victor Stinner <vstinner@python.org> | 2020-02-03 16:55:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-03 16:55:04 (GMT) |
commit | 49932fec62c616ec88da52642339d83ae719e924 (patch) | |
tree | b489d2b97cf56c0b51a15f27ecf4064c5084d9d8 /Objects/unicodeobject.c | |
parent | 24e5ad4689de9adc8e4a7d8c08fe400dcea668e6 (diff) | |
download | cpython-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/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 8e1161e..5f10437 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -1037,8 +1037,12 @@ resize_compact(PyObject *unicode, Py_ssize_t length) _PyUnicode_UTF8(unicode) = NULL; _PyUnicode_UTF8_LENGTH(unicode) = 0; } - _Py_DEC_REFTOTAL; +#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) { |