gh-111972: unicode: Make `ucnhash_capi`capsule initialization thread-safe by Eclips4 · Pull Request #112249 · python/cpython
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we also need to handle the case 'N' in _PyUnicode_DecodeUnicodeEscapeInternal.
Should we do something with _PyUnicode_Fini?
| void | |
| _PyUnicode_Fini(PyInterpreterState *interp) | |
| { | |
| struct _Py_unicode_state *state = &interp->unicode; | |
| // _PyUnicode_ClearInterned() must be called before _PyUnicode_Fini() | |
| assert(get_interned_dict(interp) == NULL); | |
| _PyUnicode_FiniEncodings(&state->fs_codec); | |
| // bpo-47182: force a unicodedata CAPI capsule re-import on | |
| // subsequent initialization of interpreter. | |
| interp->unicode.ucnhash_capi = NULL; | |
| unicode_clear_identifiers(state); | |
| } |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_PyUnicode_Fini looks fine. I don't think it needs any special handling.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters