[issue10915] Make the PyGILState API compatible with multiple interpreters

Antoine Pitrou report at bugs.python.org
Sun Jan 16 01:29:40 CET 2011

Antoine Pitrou <pitrou at free.fr> added the comment:

> A TLS based approach would presumably allow an embedding application
> like mod_wsgi to tinker with the state of threads created by naive
> modules that are unaware of the existence of subinterpreters.

The question is how mod_wsgi could know about the existence of these
threads, let alone decide which subinterpreter an arbitrary OS thread
should belong to; only the extension module can safely tell.
And it becomes totally hopeless if those threads are actually *shared*
between subinterpreters, as might be the case with a 3rd-party library
managing its own helper threads (I don't know if that's the case with

IMO we should really promote clean APIs which allow solving the whole
problem, rather than devise an internal hack to try to "improve" things


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list