diff options
author | Victor Stinner <vstinner@python.org> | 2020-02-07 00:24:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-07 00:24:29 (GMT) |
commit | c86a11221df7e37da389f9c6ce6e47ea22dc44ff (patch) | |
tree | c27a35a01bde1554488268dd3bbeb8b4c46e193c /Objects/unicodeobject.c | |
parent | a93c51e3a8e15f1a486d11d5b55a64f3381babe0 (diff) | |
download | cpython-c86a11221df7e37da389f9c6ce6e47ea22dc44ff.zip cpython-c86a11221df7e37da389f9c6ce6e47ea22dc44ff.tar.gz cpython-c86a11221df7e37da389f9c6ce6e47ea22dc44ff.tar.bz2 |
bpo-39573: Add Py_SET_REFCNT() function (GH-18389)
Add a Py_SET_REFCNT() function to set the reference counter of an
object.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 7c8bc06..fa48ee1 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -1903,7 +1903,7 @@ unicode_dealloc(PyObject *unicode) case SSTATE_INTERNED_MORTAL: /* revive dead object temporarily for DelItem */ - Py_REFCNT(unicode) = 3; + Py_SET_REFCNT(unicode, 3); if (PyDict_DelItem(interned, unicode) != 0) { _PyErr_WriteUnraisableMsg("deletion of interned string failed", NULL); @@ -15367,7 +15367,7 @@ PyUnicode_InternInPlace(PyObject **p) } /* The two references in interned are not counted by refcnt. The deallocator will take care of this */ - Py_REFCNT(s) -= 2; + Py_SET_REFCNT(s, Py_REFCNT(s) - 2); _PyUnicode_STATE(s).interned = SSTATE_INTERNED_MORTAL; } |