bpo-40881: Fix unicode_release_interned() (GH-20699)

Use Py_SET_REFCNT() in unicode_release_interned().
This commit is contained in:
Victor Stinner 2020-06-08 01:39:47 +02:00 committed by GitHub
parent 7907f8cbc6
commit c96a61e816
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -15669,13 +15669,13 @@ unicode_release_interned(void)
} }
switch (PyUnicode_CHECK_INTERNED(s)) { switch (PyUnicode_CHECK_INTERNED(s)) {
case SSTATE_INTERNED_IMMORTAL: case SSTATE_INTERNED_IMMORTAL:
Py_REFCNT(s) += 1; Py_SET_REFCNT(s, Py_REFCNT(s) + 1);
#ifdef INTERNED_STATS #ifdef INTERNED_STATS
immortal_size += PyUnicode_GET_LENGTH(s); immortal_size += PyUnicode_GET_LENGTH(s);
#endif #endif
break; break;
case SSTATE_INTERNED_MORTAL: case SSTATE_INTERNED_MORTAL:
Py_REFCNT(s) += 2; Py_SET_REFCNT(s, Py_REFCNT(s) + 2);
#ifdef INTERNED_STATS #ifdef INTERNED_STATS
mortal_size += PyUnicode_GET_LENGTH(s); mortal_size += PyUnicode_GET_LENGTH(s);
#endif #endif