From c96a61e8163c2d25ed4ac77cf96201fd0bdb945c Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 8 Jun 2020 01:39:47 +0200 Subject: [PATCH] bpo-40881: Fix unicode_release_interned() (GH-20699) Use Py_SET_REFCNT() in unicode_release_interned(). --- Objects/unicodeobject.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index e69bf01251c..df10888949a 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