Closed
Description
Feature or enhancement
I propose adding a new function to the sys
module to check if the GIL is current enabled:
sys._is_gil_enabled() -> bool Return True if the GIL is currently enabled and False if the GIL is currently disabled.
The function would always return True
in builds that do not support free-threading. In the free-threaded build, the the GIL might be dynamically enabled or disabled depending on imported modules.
EDIT: Changed name to use underscore prefix