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
"Non-Python created threads" documentation doesn't mention PyEval_InitThreads() #63775
Comments
While working on a unit test for the issue bpo-14432, I hit a bug. My C thread got the GIL with PyGILState_Ensure(), but it was strange because the main Python thread also had the GIL... Then I saw that gil_created() returned false. The solution is to call PyEval_InitThreads() to create the GIL. I was reading "Non-Python created threads" documentation, but this section doesn't mention PyEval_InitThreads(). I don't know if it's something new in Python 3.2 with the new GIL. |
Perhaps we can fix PyGILState to call PyEval_InitThreads automatically? |
Yes, I had the same idea. Here is a patch to call PyEval_InitThreads() in PyGILState_Ensure() for new threads. |
So Antoine, what do you think of the fix? |
Looks good to me. |
New changeset dc4e805ec68a by Victor Stinner in branch 'default': |
this patch made a new issue<20891> |
I think that the document regarding PyGILState_Ensure and PyEval_InitThreads should be clarified better, written in issue bpo-26003 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: