[Python-checkins] bpo-40521: Fix PyUnicode_InternInPlace() (GH-22376)

Victor Stinner webhook-mailer at python.org
Wed Sep 23 08:05:37 EDT 2020


https://github.com/python/cpython/commit/7f413a5d95e6d7ddddd6e2c9844c33594d6288f4
commit: 7f413a5d95e6d7ddddd6e2c9844c33594d6288f4
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-09-23T14:05:32+02:00
summary:

bpo-40521: Fix PyUnicode_InternInPlace() (GH-22376)

Fix PyUnicode_InternInPlace() when the INTERNED_STRINGS macro is not
defined (when the EXPERIMENTAL_ISOLATED_SUBINTERPRETERS macro is
defined).

files:
M Objects/unicodeobject.c

diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index fd0e8e008adae..f32ab417c364c 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -15754,6 +15754,10 @@ PyUnicode_InternInPlace(PyObject **p)
        this. */
     Py_SET_REFCNT(s, Py_REFCNT(s) - 2);
     _PyUnicode_STATE(s).interned = SSTATE_INTERNED_MORTAL;
+#else
+    // PyDict expects that interned strings have their hash
+    // (PyASCIIObject.hash) already computed.
+    (void)unicode_hash(s);
 #endif
 }
 



More information about the Python-checkins mailing list