Skip to content

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

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

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 November 22, 2018 16:32
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.

4 participants