[Python-checkins] bpo-40881: Fix unicode_release_interned() (GH-20699)

Victor Stinner webhook-mailer at python.org
Sun Jun 7 19:39:52 EDT 2020


https://github.com/python/cpython/commit/c96a61e8163c2d25ed4ac77cf96201fd0bdb945c
commit: c96a61e8163c2d25ed4ac77cf96201fd0bdb945c
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-06-08T01:39:47+02:00
summary:

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

Use Py_SET_REFCNT() in unicode_release_interned().

files:
M Objects/unicodeobject.c

diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index e69bf01251ced..df10888949aba 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -15669,13 +15669,13 @@ unicode_release_interned(void)
         }
         switch (PyUnicode_CHECK_INTERNED(s)) {
         case SSTATE_INTERNED_IMMORTAL:
-            Py_REFCNT(s) += 1;
+            Py_SET_REFCNT(s, Py_REFCNT(s) + 1);
 #ifdef INTERNED_STATS
             immortal_size += PyUnicode_GET_LENGTH(s);
 #endif
             break;
         case SSTATE_INTERNED_MORTAL:
-            Py_REFCNT(s) += 2;
+            Py_SET_REFCNT(s, Py_REFCNT(s) + 2);
 #ifdef INTERNED_STATS
             mortal_size += PyUnicode_GET_LENGTH(s);
 #endif



More information about the Python-checkins mailing list