-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Closed
Closed
Copy link
Labels
3.13bugs and security fixesbugs and security fixestopic-free-threadingtype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
The _PyUnicode_Name_CAPI
provides functions to get the name for a given Unicode character code and vice versa. It is lazily initialized and stored in the per-interpreter _Py_unicode_state
:
cpython/Include/internal/pycore_unicodeobject.h
Lines 425 to 432 in 3932b0f
struct _Py_unicode_state { | |
struct _Py_unicode_fs_codec fs_codec; | |
_PyUnicode_Name_CAPI *ucnhash_capi; | |
// Unicode identifiers (_Py_Identifier): see _PyUnicode_FromId() | |
struct _Py_unicode_ids ids; | |
}; |
The initialization of the ucnhash_capi
isn't thread-safe without the GIL. (There can be a data race on reading and writing ucnhash_capi
).
Mostly for my own reference, here are the similar modifications in the nogil-3.12
fork: colesbury/nogil-3.12@5d006db9fa
Linked PRs
Metadata
Metadata
Assignees
Labels
3.13bugs and security fixesbugs and security fixestopic-free-threadingtype-featureA feature request or enhancementA feature request or enhancement