]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.10] bpo-47182: Fix crash by named unicode characters after interpreter reinitializ...
authorChristian Heimes <christian@python.org>
Fri, 1 Apr 2022 08:44:56 +0000 (11:44 +0300)
committerGitHub <noreply@github.com>
Fri, 1 Apr 2022 08:44:56 +0000 (10:44 +0200)
Co-authored-by: Christian Heimes <christian@python.org>
Misc/NEWS.d/next/Core and Builtins/2022-03-31-15-37-02.bpo-47182.e_4SsC.rst [new file with mode: 0644]
Objects/unicodeobject.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-03-31-15-37-02.bpo-47182.e_4SsC.rst b/Misc/NEWS.d/next/Core and Builtins/2022-03-31-15-37-02.bpo-47182.e_4SsC.rst
new file mode 100644 (file)
index 0000000..08036bc
--- /dev/null
@@ -0,0 +1,2 @@
+Fix a crash when using a named unicode character like ``"\N{digit nine}"``
+after the main interpreter has been initialized a second time.
index 077cf8d7f45605ff184a53531c78bfb84cecd34e..377fa6c8e2a28bd500ce97a34dfe30217722cd1c 100644 (file)
@@ -16352,6 +16352,9 @@ _PyUnicode_Fini(PyInterpreterState *interp)
     if (_Py_IsMainInterpreter(interp)) {
         // _PyUnicode_ClearInterned() must be called before _PyUnicode_Fini()
         assert(interned == NULL);
+        // bpo-47182: force a unicodedata CAPI capsule re-import on
+        // subsequent initialization of main interpreter.
+        ucnhash_capi = NULL;
     }
 
     _PyUnicode_FiniEncodings(&state->fs_codec);