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

WIP: bpo-35059: _PyThreadState_GET() checks that the GIL is hold #10278

Closed
wants to merge 1 commit into from

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Nov 1, 2018

Convert _PyThreadState_GET() and _PyInterpreterState_GET_UNSAFE()
macros to static inline functions, and the functions now check that
the GIL is hold.

Add _PyThreadState_GET_UNSAFE(): similar to _PyThreadState_GET(), but
don't check that the GIL is hold.

https://bugs.python.org/issue35059

Convert _PyThreadState_GET() and _PyInterpreterState_GET_UNSAFE()
macros to static inline functions, and the functions now check that
the GIL is hold.

Add _PyThreadState_GET_UNSAFE(): similar to _PyThreadState_GET(), but
don't check that the GIL is hold.
@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Nov 1, 2018

This can hit performance. Could you open issues for such potentially dangerous changes?

@vstinner
Copy link
Member Author

vstinner commented Nov 1, 2018

This can hit performance. Could you open issues for such potentially dangerous changes?

I used https://bugs.python.org/issue35059 for all changes converting macros to static inline functions. Would you prefer a new dedicated issue for this change?

@vstinner
Copy link
Member Author

vstinner commented Nov 1, 2018

Right now, I'm not sure that this change is correct. I'm not sure that _PyThreadState_GET() and _PyInterpreterState_GET_UNSAFE() must be called with the GIL hold.

@vstinner
Copy link
Member Author

vstinner commented Nov 22, 2018

As @serhiy-storchaka wrote, this change looks dangerous. There is a risk of regression. I'm not sure that it's really worth it. I prefer to close my PR.

@vstinner vstinner closed this Nov 22, 2018
@vstinner vstinner deleted the check_gil branch Nov 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants