Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent greenlet from building on free-threaded Python #423

Open
jamadden opened this issue Sep 10, 2024 · 2 comments
Open

Prevent greenlet from building on free-threaded Python #423

jamadden opened this issue Sep 10, 2024 · 2 comments
Labels
Feature Request Feature request Help Wanted Internal Discussions on processes, etc, that don't directly face end users

Comments

@jamadden
Copy link
Contributor

We don't set the flag that indicates we're compatible with free-threading, so loading us would automatically enable the GIL according to the Python documentation. It is thus misleading that we can even build on a free-threaded Python and get the "t" suffix, e.g., "313t".

The make-manylinux script has some support for skipping free-threaded Python's, but it's neither complete nor sufficient.

The trouble is that CPython doesn't document a way to detect at compile time that it is built on free-threading. At least, not that I could see in the "Porting to 3.13" and "C API Changes" sections of the release notes.

@jamadden jamadden added Help Wanted Internal Discussions on processes, etc, that don't directly face end users Feature Request Feature request labels Sep 10, 2024
@LeroyK111
Copy link

0.06s - pydevd: GEVENT_SUPPORT is set but gevent is not available in the environment. Please unset GEVENT_SUPPORT from the environment variables or install gevent. Traceback (most recent call last): File "c:\Users\Administrator\.vscode\extensions\ms-python.debugpy-2024.13.2024101501-win32-x64\bundled\libs\debugpy\_vendored\pydevd\pydevd.py", line 166, in <module> from _pydevd_bundle import pydevd_gevent_integration File "c:\Users\Administrator\.vscode\extensions\ms-python.debugpy-2024.13.2024101501-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_gevent_integration.py", line 2, in <module> import greenlet File "d:\python\Lib\site-packages\greenlet\__init__.py", line 29, in <module> from ._greenlet import _C_API # pylint:disable=no-name-in-module ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'greenlet._greenlet'

So, I configured the launch.json file in VSCode and set the "gevent" field to false. After that, I was able to use Python's free-threaded version, which disables the GIL (Global Interpreter Lock) without any issues.

@jamadden
Copy link
Contributor Author

If you load the extension, it's going to initialize the GIL. If you force Python to not initialize the GIL, the extension will be broken. Do not do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Feature request Help Wanted Internal Discussions on processes, etc, that don't directly face end users
Projects
None yet
Development

No branches or pull requests

2 participants