Skip to content

Commit c96a61e

Browse files
authored
bpo-40881: Fix unicode_release_interned() (GH-20699)
Use Py_SET_REFCNT() in unicode_release_interned().
1 parent 7907f8c commit c96a61e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Objects/unicodeobject.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -15669,13 +15669,13 @@ unicode_release_interned(void)
1566915669
}
1567015670
switch (PyUnicode_CHECK_INTERNED(s)) {
1567115671
case SSTATE_INTERNED_IMMORTAL:
15672-
Py_REFCNT(s) += 1;
15672+
Py_SET_REFCNT(s, Py_REFCNT(s) + 1);
1567315673
#ifdef INTERNED_STATS
1567415674
immortal_size += PyUnicode_GET_LENGTH(s);
1567515675
#endif
1567615676
break;
1567715677
case SSTATE_INTERNED_MORTAL:
15678-
Py_REFCNT(s) += 2;
15678+
Py_SET_REFCNT(s, Py_REFCNT(s) + 2);
1567915679
#ifdef INTERNED_STATS
1568015680
mortal_size += PyUnicode_GET_LENGTH(s);
1568115681
#endif

0 commit comments

Comments
 (0)