bpo-40881: Fix unicode_release_interned() (GH-20699) · python/cpython@c96a61e (original) (raw)

Original file line number Diff line number Diff line change
@@ -15669,13 +15669,13 @@ unicode_release_interned(void)
15669 15669 }
15670 15670 switch (PyUnicode_CHECK_INTERNED(s)) {
15671 15671 case SSTATE_INTERNED_IMMORTAL:
15672 -Py_REFCNT(s) += 1;
15672 +Py_SET_REFCNT(s, Py_REFCNT(s) + 1);
15673 15673 #ifdef INTERNED_STATS
15674 15674 immortal_size += PyUnicode_GET_LENGTH(s);
15675 15675 #endif
15676 15676 break;
15677 15677 case SSTATE_INTERNED_MORTAL:
15678 -Py_REFCNT(s) += 2;
15678 +Py_SET_REFCNT(s, Py_REFCNT(s) + 2);
15679 15679 #ifdef INTERNED_STATS
15680 15680 mortal_size += PyUnicode_GET_LENGTH(s);
15681 15681 #endif