]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-116167: Allow disabling the GIL with `PYTHON_GIL=0` or `-X gil=0` (#116338)
authorBrett Simmers <swtaarrs@users.noreply.github.com>
Mon, 11 Mar 2024 15:02:58 +0000 (11:02 -0400)
committerGitHub <noreply@github.com>
Mon, 11 Mar 2024 15:02:58 +0000 (11:02 -0400)
commit2731913dd5234ff5ab630a3b7f1c98ad79d4d9df
treec666bae1112581bf0fe4c23ced8d188082cbcefd
parent546eb7a3be241c5abd8a83cebbbab8c71107edcf
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.
12 files changed:
Doc/using/cmdline.rst
Include/cpython/initconfig.h
Include/internal/pycore_gil.h
Include/internal/pycore_initconfig.h
Lib/subprocess.py
Lib/test/_test_embed_set_config.py
Lib/test/test_cmd_line.py
Lib/test/test_embed.py
Misc/python.man
Python/ceval_gil.c
Python/initconfig.c
Python/sysmodule.c