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 asvetlov, grahamd, mhammond, ncoghlan, pitrou
Date 2012-08-28.22:10:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1346191813.13.0.60126446433.issue15751@psf.upfronthosting.co.za>
In-reply-to
Content
Sorry, Mark. Is not for associating thread state specified by embedding application. In simple terms it is exactly like existing PyGILState_Ensure() in that caller doesn't have a thread state, whether it has already been created. Only difference is to allow that simplified API to work against a sub interpreter.

Nick, I previously said:

"""In the case of the latter, if a Python thread is created in a specific sub interpreter, it should automatically designate for that thread that that is its interpreter context, so if it calls out and does the Release/Ensure dance, that it goes back into the same sub interpreter."""

So yes to your:

"""Thinking about it, I believe there still needs to be a concept of an "active thread state" TLS key in order to deal with Graham's original problem. Specifically, if PyGILState_EnsureEx is used to associate the thread with a particular interpreter, then subsequent calls to PyGILState_Ensure from *that thread* should get the explicitly associated interpreter, rather than the main interpreter."""

My example was more to do with a thread created in Python then calling out and back in, but same deal as foreign thread calling in, out and back in.

Antoine, yes, can possibly can be simplified to that. The original idea of a switch interpreter function was suggested on basis that PyGILState_Ensure would not be modified or extended version of function created. Rolling an implicit switch interpreter into PyGILState_EnsureEx when argument is different to the current may serve same purpose.
History
Date User Action Args
2012-08-28 22:10:13grahamdsetrecipients: + grahamd, mhammond, ncoghlan, pitrou, asvetlov
2012-08-28 22:10:13grahamdsetmessageid: <1346191813.13.0.60126446433.issue15751@psf.upfronthosting.co.za>
2012-08-28 22:10:12grahamdlinkissue15751 messages
2012-08-28 22:10:12grahamdcreate