mirror of
https://github.com/python/cpython.git
synced 2025-08-23 02:04:56 +00:00
GH-127705: Fix _Py_RefcntAdd to handle objects becoming immortal (GH-131140)
This commit is contained in:
parent
061da44bac
commit
f30376c650
3 changed files with 20 additions and 11 deletions
|
@ -15982,7 +15982,7 @@ _PyUnicode_ClearInterned(PyInterpreterState *interp)
|
|||
case SSTATE_INTERNED_MORTAL:
|
||||
// Restore 2 references held by the interned dict; these will
|
||||
// be decref'd by clear_interned_dict's PyDict_Clear.
|
||||
Py_SET_REFCNT(s, Py_REFCNT(s) + 2);
|
||||
_Py_RefcntAdd(s, 2);
|
||||
#ifdef Py_REF_DEBUG
|
||||
/* let's be pedantic with the ref total */
|
||||
_Py_IncRefTotal(_PyThreadState_GET());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue