[Python-checkins] [3.10] bpo-47182: Fix crash by named unicode characters after interpreter reinitialization (GH-32212) (GH-32216)
tiran
webhook-mailer at python.org
Fri Apr 1 04:45:06 EDT 2022
https://github.com/python/cpython/commit/55d5c96c57738766eb6f3b5ccfa6599d5f094c18
commit: 55d5c96c57738766eb6f3b5ccfa6599d5f094c18
branch: 3.10
author: Christian Heimes <christian at python.org>
committer: tiran <christian at python.org>
date: 2022-04-01T10:44:56+02:00
summary:
[3.10] bpo-47182: Fix crash by named unicode characters after interpreter reinitialization (GH-32212) (GH-32216)
Co-authored-by: Christian Heimes <christian at python.org>
files:
A Misc/NEWS.d/next/Core and Builtins/2022-03-31-15-37-02.bpo-47182.e_4SsC.rst
M 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
index 0000000000000..08036bc680933
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2022-03-31-15-37-02.bpo-47182.e_4SsC.rst
@@ -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.
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 077cf8d7f4560..377fa6c8e2a28 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -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);
More information about the Python-checkins
mailing list