mirror of
https://github.com/python/cpython
synced 2026-09-28 06:13:18 +03:00
gh-116738: Make _codecs module thread-safe (#117530)
The module itself is a thin wrapper around calls to functions in `Python/codecs.c`, so that's where the meaningful changes happened: - Move codecs-related state that lives on `PyInterpreterState` to a struct declared in `pycore_codecs.h`. - In free-threaded builds, add a mutex to `codecs_state` to synchronize operations on `search_path`. Because `search_path_mutex` is used as a normal mutex and not a critical section, we must be extremely careful with operations called while holding it. - The codec registry is explicitly initialized as part of `_PyUnicode_InitEncodings` to simplify thread-safety.
This commit is contained in:
parent
4e2caf2aa0
commit
f8290df63f
6 changed files with 120 additions and 79 deletions
|
|
@ -344,7 +344,7 @@ Python/ceval.c - _PyEval_BinaryOps -
|
|||
Python/ceval.c - _Py_INTERPRETER_TRAMPOLINE_INSTRUCTIONS -
|
||||
Python/codecs.c - Py_hexdigits -
|
||||
Python/codecs.c - ucnhash_capi -
|
||||
Python/codecs.c _PyCodecRegistry_Init methods -
|
||||
Python/codecs.c _PyCodec_InitRegistry methods -
|
||||
Python/compile.c - NO_LABEL -
|
||||
Python/compile.c - NO_LOCATION -
|
||||
Python/dynload_shlib.c - _PyImport_DynLoadFiletab -
|
||||
|
|
|
|||
|
Can't render this file because it has a wrong number of fields in line 4.
|
Loading…
Add table
Add a link
Reference in a new issue