This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author grahamd
Recipients grahamd, neologix, pitrou
Date 2011-10-12.08:04:01
SpamBayes Score 7.162952e-08
Marked as misclassified No
Message-id <1318406642.45.0.915206112957.issue13156@psf.upfronthosting.co.za>
In-reply-to
Content
The PyGILState_Ensure() function is only for when working with the main interpreter. These external threads are not calling into the main interpreter.

Because they are external threads, calling PyGILState_Ensure() and then PyGILState_Release() will cause a thread state to be created for the main interpreter, but it will also be destroyed on the PyGILState_Release().

The only way to avoid that situation and ensure that the thread state for the main interpreter is therefore maintained would be to call PyGILState_Ensure() and then call PyThreadState_Swap() to change to thread state for the sub interpreter. Problem is that you aren't supposed to use PyThreadState_Swap() any more and recollect that newer Python 3.X even prohibits it in some way through some checks.

So, the documentation you quote is only to do with the main interpreter and is not how things work for sub interpreters.
History
Date User Action Args
2011-10-12 08:04:02grahamdsetrecipients: + grahamd, pitrou, neologix
2011-10-12 08:04:02grahamdsetmessageid: <1318406642.45.0.915206112957.issue13156@psf.upfronthosting.co.za>
2011-10-12 08:04:01grahamdlinkissue13156 messages
2011-10-12 08:04:01grahamdcreate