-
Notifications
You must be signed in to change notification settings - Fork 431
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
Detect GIL on python 3.12+ #692
Comments
also worth mentioning: deadsnakes is already building python3.13-nogil, meaning you'll have a on the nogil build you can turn it on and off for instance via env var ref https://github.com/python/cpython/blob/v3.13.0/Lib/test/test_cmd_line.py#L882
|
To check my understanding - this means that results can be quite skewed in multithreaded programs right where more than one thread does significant work? If two threads are working in function |
No - the idle detection code in py-spy should prevent skewing the results here . Not having GIL support in python 3.12 means that we can't use the |
@ddelange I'm excited to try out the deadsnakes nogil option =) |
Similarly, uv supports installing freethreaded Python distributions that could be used for testing here. |
Ah, that's great! So the only downside is more sampling overhead in some cases 👌 |
Fwiw - fixing this turned out to be easier than I initially thought (We can read the |
Python 3.12 moved from having the GIL held in
_PyRuntime.tstate_current
to being in thread local storage #633 (comment) . This means that we currently can't detect which thread is holding the GILThe text was updated successfully, but these errors were encountered: