-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed as duplicate of#143747
Closed as duplicate of#143747
Copy link
Description
I’d like to propose exposing _PyEval_IsGILEnabled as an unstable, CPython-specific C API.
Context
- CPython recently added
sys._is_gil_enabled()as a Python-level diagnostic API. - Some C extensions would like to make similar diagnostic or configuration decisions without calling back into Python (e.g. via
PySys_GetAttr+PyObject_CallNoArgs). - During discussion on Discourse, a CPython core developer suggested that exposing an existing helper such as
_PyEval_IsGILEnabledwould be preferable to introducing a new API that requires passing aPyInterpreterState *.
Discourse discussion
Related GitHub issue
Proposal
- Expose
_PyEval_IsGILEnabledas an unstable, CPython-specific C API. - The API would live under
Include/cpython/and would not be part of the stable ABI. - The intended use is diagnostics, reporting, or choosing reasonable defaults in C extensions (e.g. selecting threading vs multiprocessing backends), not for controlling GIL behavior.
I’m seeking feedback and approval from the C API Working Group on whether exposing this API is acceptable before proceeding with any implementation.
Metadata
Metadata
Assignees
Labels
No labels