bpo-47182: Fix crash by named unicode characters after interpreter reinitialization (GH-32212)

Automerge-Triggered-By: GH:tiran
This commit is contained in:
Christian Heimes 2022-03-31 18:14:50 +03:00 committed by GitHub
parent 5458b7e39e
commit 44e915028d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View file

@ -16085,6 +16085,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);