mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-116167: Allow disabling the GIL with PYTHON_GIL=0
or -X gil=0
(#116338)
In free-threaded builds, running with `PYTHON_GIL=0` will now disable the GIL. Follow-up issues track work to re-enable the GIL when loading an incompatible extension, and to disable the GIL by default. In order to support re-enabling the GIL at runtime, all GIL-related data structures are initialized as usual, and disabling the GIL simply sets a flag that causes `take_gil()` and `drop_gil()` to return early.
This commit is contained in:
parent
546eb7a3be
commit
2731913dd5
12 changed files with 163 additions and 1 deletions
|
@ -523,6 +523,8 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
|
|||
CONFIG_COMPAT['_pystats'] = 0
|
||||
if support.Py_DEBUG:
|
||||
CONFIG_COMPAT['run_presite'] = None
|
||||
if support.Py_GIL_DISABLED:
|
||||
CONFIG_COMPAT['enable_gil'] = -1
|
||||
if MS_WINDOWS:
|
||||
CONFIG_COMPAT.update({
|
||||
'legacy_windows_stdio': 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue