From cd5b6e5de82212c80b1b7259e5889bb44dd0c970 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 23 Sep 2020 12:53:55 +0200 Subject: [PATCH] bpo-40521: Fix PyUnicode_InternInPlace() Fix PyUnicode_InternInPlace() when the INTERNED_STRINGS macro is not defined (when the EXPERIMENTAL_ISOLATED_SUBINTERPRETERS macro is defined). --- Objects/unicodeobject.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index fd0e8e008adae4..f32ab417c364ca 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 }