Skip to content

Use PyGILState_Ensure to avoid accessing CPython internals - #269

Open
ngoldbaum wants to merge 2 commits into
python-cffi:mainfrom
ngoldbaum:rm-old-python-hacks
Open

Use PyGILState_Ensure to avoid accessing CPython internals#269
ngoldbaum wants to merge 2 commits into
python-cffi:mainfrom
ngoldbaum:rm-old-python-hacks

Conversation

@ngoldbaum

Copy link
Copy Markdown
Contributor

Following a suggestion from @kumaraditya303, this removes direct access to the PyThreadState struct in gil_ensure() and replaces it with PyGILState_Ensure.

The direct struct access is the cause of the crash in #263.

The current code dates back to Python 3.6 and works around differences spanning the Python 2->3 transition. That is all historical now. The code that is currently active is identical to the content of PyGILState_Ensure.

Comment thread src/c/call_python.c

@kumaraditya303 kumaraditya303 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants