From ea251806b8dffff11b30d2182af1e589caf88acf Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 26 Dec 2020 02:58:33 +0100 Subject: bpo-40521: Per-interpreter interned strings (GH-20085) Make the Unicode dictionary of interned strings compatible with subinterpreters. Remove the INTERN_NAME_STRINGS macro in typeobject.c: names are always now interned (even if EXPERIMENTAL_ISOLATED_SUBINTERPRETERS macro is defined). _PyUnicode_ClearInterned() now uses PyDict_Next() to no longer allocate memory, to ensure that the interned dictionary is cleared. --- Python/pylifecycle.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Python/pylifecycle.c') diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index c3c1aa22e9..ccbacb4819 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -1573,6 +1573,8 @@ finalize_interp_types(PyThreadState *tstate) _PyFrame_Fini(tstate); _PyAsyncGen_Fini(tstate); _PyContext_Fini(tstate); + // Call _PyUnicode_ClearInterned() before _PyDict_Fini() since it uses + // a dict internally. _PyUnicode_ClearInterned(tstate); _PyDict_Fini(tstate); -- cgit v1.2.1