]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-116322: Enable the GIL while loading C extension modules (#118560)
authorBrett Simmers <swtaarrs@users.noreply.github.com>
Tue, 7 May 2024 03:07:23 +0000 (20:07 -0700)
committerGitHub <noreply@github.com>
Tue, 7 May 2024 03:07:23 +0000 (23:07 -0400)
commit853163d3b5fa56d54a47817642c804b5d0c9f8e5
tree5195947cdc876c0bb4f5de0be8d8f4a2e7e75a7f
parent60bd1118447e00755320cf8a0f439c827d498b51
gh-116322: Enable the GIL while loading C extension modules (#118560)

Add the ability to enable/disable the GIL at runtime, and use that in
the C module loading code.

We can't know before running a module init function if it supports
free-threading, so the GIL is temporarily enabled before doing so. If
the module declares support for running without the GIL, the GIL is
later disabled. Otherwise, the GIL is permanently enabled, and will
never be disabled again for the life of the current interpreter.
Include/internal/pycore_ceval.h
Include/internal/pycore_gil.h
Include/internal/pycore_import.h
Misc/NEWS.d/next/Core and Builtins/2024-05-03-17-49-37.gh-issue-116322.Gy6M4j.rst [new file with mode: 0644]
PC/_wmimodule.cpp
Python/ceval_gil.c
Python/import.c
Python/pystate.c
Python/sysmodule.c