-
Notifications
You must be signed in to change notification settings - Fork 58
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
WIP: Mark C level functions as nogil
#383
Conversation
2c7d772
to
5390564
Compare
These functions should be safe to use without the Python GIL as they are not creating or destroying Python objects. So mark them as such. Note: This does **not** actually release the GIL. We still have to do that ourselves. However this allows us to use these in code sections where we have already released the GIL. We can also continue to use them when we have the GIL as well.
5390564
to
6402812
Compare
Thansk @jakirkham . Looks like CI is failing with legitimate errors:
|
Yeah that should be fixed by PR ( #390 ). |
Even though this passes. We should hold off on merging for a bit as there are some warning. These highlight some additional changes we need. From the log we can see the following warnings:
This is happening because the C functions potentially may not hold the GIL when calling our Cython callbacks. We can fix this by defining our Cython callbacks to also not hold the GIL, but acquire it internally when it is needed. Will make some changes to this affect in a second. |
nogil
nogil
To fix the warnings, it makes to type our callbacks as |
These functions should be safe to use without the Python GIL as they are not creating or destroying Python objects. So mark them as such.
Note: This does not actually release the GIL. We still have to do that ourselves. However this allows us to use these in code sections where we have already released the GIL. We can also continue to use them when we have the GIL as well.