mirror of
https://github.com/python/cpython.git
synced 2026-11-09 06:00:54 +08:00
gh-152075: Avoid lock contention in _Py_Specialize_LoadGlobal under free threading (gh-153720)
Under high thread concurrency in free-threaded builds, `_Py_Specialize_LoadGlobal` suffers from lock contention when acquiring the critical section mutexes for the `globals` and `builtins` dictionaries during bytecode specialization.
This PR skips LOAD_GLOBAL bytecode specialization if acquiring the two object mutexes would block.
(cherry picked from commit ac8ba0ca5a)
Co-authored-by: Peter Hawkins <[email protected]>
Miscellaneous source files for the main Python shared library