Skip to content

Commit 55d5c96

Browse files
authored
[3.10] bpo-47182: Fix crash by named unicode characters after interpreter reinitialization (GH-32212) (GH-32216)
Co-authored-by: Christian Heimes <[email protected]>
1 parent 9ed179b commit 55d5c96

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix a crash when using a named unicode character like ``"\N{digit nine}"``
2+
after the main interpreter has been initialized a second time.

Objects/unicodeobject.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16352,6 +16352,9 @@ _PyUnicode_Fini(PyInterpreterState *interp)
1635216352
if (_Py_IsMainInterpreter(interp)) {
1635316353
// _PyUnicode_ClearInterned() must be called before _PyUnicode_Fini()
1635416354
assert(interned == NULL);
16355+
// bpo-47182: force a unicodedata CAPI capsule re-import on
16356+
// subsequent initialization of main interpreter.
16357+
ucnhash_capi = NULL;
1635516358
}
1635616359

1635716360
_PyUnicode_FiniEncodings(&state->fs_codec);

0 commit comments

Comments
 (0)