summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-06-07 23:39:47 (GMT)
committerGitHub <noreply@github.com>2020-06-07 23:39:47 (GMT)
commitc96a61e8163c2d25ed4ac77cf96201fd0bdb945c (patch)
treecf3f11f1ec81861e3a32e5ddb47b6a20dffa029b
parent7907f8cbc6923240edb0b5b63adafb871c4c8875 (diff)
downloadcpython-c96a61e8163c2d25ed4ac77cf96201fd0bdb945c.zip
cpython-c96a61e8163c2d25ed4ac77cf96201fd0bdb945c.tar.gz
cpython-c96a61e8163c2d25ed4ac77cf96201fd0bdb945c.tar.bz2
bpo-40881: Fix unicode_release_interned() (GH-20699)
Use Py_SET_REFCNT() in unicode_release_interned().
-rw-r--r--Objects/unicodeobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index e69bf01..df10888 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