summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-09-23 12:05:32 (GMT)
committerGitHub <noreply@github.com>2020-09-23 12:05:32 (GMT)
commit7f413a5d95e6d7ddddd6e2c9844c33594d6288f4 (patch)
treed3b8bf07fae75e7c2528ae4ee11ac8647770205e /Objects
parent19c3ac92bf73f1902cff846988552fd7bb8a8621 (diff)
downloadcpython-7f413a5d95e6d7ddddd6e2c9844c33594d6288f4.zip
cpython-7f413a5d95e6d7ddddd6e2c9844c33594d6288f4.tar.gz
cpython-7f413a5d95e6d7ddddd6e2c9844c33594d6288f4.tar.bz2
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).
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index fd0e8e0..f32ab41 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
}