Nick Coghlan <ncogh...@gmail.com> added the comment:

Graham - the cases you describe are the things I was saying don't currently 
work in my post and wouldn't be helped by Antoine's patch. Your thoughts on how 
we could possibly make it work actually parallel mine (although there may be 
fun and games with making sure the respective GILs are acquired and released in 
an appropriate order when switching interpreters).

However, if a given OS thread is created by a subinterpreter via 
thread_PyThread_start_new_thread, then the thread bootstrapping process will 
copy the thread state from that subinterpreter rather than the main interpreter.

Accordingly, the only thing that I believe should currently work with 
subinterpreters is the naive use case you described earlier (i.e. a call out to 
an extension module from a Python created thread that later calls back in using 
the PyGILState API in the exact same thread should work even in the presence of 
multiple interpreters).

This is the use case that I believe Antoine's patch as it currently stands 
actively *breaks* by making the autoTLSkey interpreter dependent.

Regardless, I'm marking 10914 as a dependency of this one, as I don't think we 
should change anything in this area until we have some unit tests to properly 
define what does and doesn't work. If we're going to promote subinterpreters to 
a robust, fully supported feature we may as well do it right.

----------
dependencies: +Python sub-interpreter test

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10915>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to