[Python-Dev] 'Subinterpreter' (was Re: Pre-PEP: Redesigning extension modules)
Terry Reedy
tjreedy at udel.edu
Mon Sep 2 01:38:58 CEST 2013
On 9/1/2013 5:13 PM, Stefan Behnel wrote:
> Antoine Pitrou, 01.09.2013 22:06:
>> On Sun, 01 Sep 2013 16:02:33 -0400
>> Terry Reedy wrote:
>>>> Speaking of which, it also doesn't work (well) with subinterpreters:
>>>
>>> Could someone briefly explain 'subinterpreter' or point me somewhere in
>>> the docs? It appears throughout this thread but there is no index or
>>> glossary entry.
>>
>> http://docs.python.org/dev/c-api/init.html#sub-interpreter-support
So cpython specific.
>> Subinterpreters are a somewhat borderline feature that allows embedding
>> applications to host multiple Python programs in a single process. A
>> well-known example is mod_wsgi.
Thank you for both the link *and* the explanatory example, which just
what I needed to make the past discussion more intelligible. I imagine
that wsgi uses a sub-interpreter for each user connection.
> And extension modules usually don't play well with subinterpreters because
> each subinterpreter requires its own separate version of the module and
> extension modules are rarely designed to keep their state completely local
> to an interpreter, let alone being prepared for having their module init
> function be called more than once.
I can see now why this is a bit of a 'hair-puller';-).
--
Terry Jan Reedy
More information about the Python-Dev
mailing list