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:
|
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
Feature or enhancement
The
_PyUnicode_Name_CAPIprovides 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
The initialization of the
ucnhash_capiisn't thread-safe without the GIL. (There can be a data race on reading and writingucnhash_capi).Mostly for my own reference, here are the similar modifications in the
nogil-3.12fork: colesbury/nogil-3.12@5d006db9faLinked PRs
ucnhash_capicapsule initialization thread-safe #112249