Skip to content

Conversation

@jmao-denver
Copy link
Contributor

@jmao-denver jmao-denver commented Jan 9, 2026

fixes #217

@jmao-denver jmao-denver self-assigned this Jan 9, 2026
@jmao-denver jmao-denver marked this pull request as ready for review January 10, 2026 16:58
Comment on lines +173 to +174
// The sys._is_gil_enabled() function is the documented, stable way to check GIL status from both
// Python code and C extensions in Python 3.13+ free-threaded builds.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is quite true. The documentation at https://docs.python.org/3/library/sys.html#sys._is_gil_enabled says:

CPython implementation detail: It is not guaranteed to exist in all implementations of Python.

In general, I think the _ prefix in a context like this means it's not part of the stable API.

I do think we should strive to work with other implementations of Python.

That said, as you mention, it's possible that python doesn't provide a stable way to call this from C API yet.

I think we should at least note we'd prefer to call stable C API here, and create a follow-up in the future (/ link to our issue / link to c python issue).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

jpy should provide a Java method to check if Python GIL is enabled .

3 participants