Embedding multiple interpreters
garthy_nhtyp at entropicsoftware.com
Fri Dec 6 09:21:56 CET 2013
On 06/12/13 17:28, Gregory Ewing wrote:
> Garthy wrote:
>> I am running into problems when using multiple interpreters  and I
>> am presently trying to track down these issues. Can anyone familiar
>> with the process of embedding multiple interpreters have a skim of the
>> details below and let me know of any obvious problems?
> As far as I know, multiple interpreters in one process is
> not really supported. There *seems* to be partial support for
> it in the code, but there is no way to fully isolate them
> from each other.
That's not good to hear.
Is there anything confirming that it's an incomplete API insofar as
multiple interpreters are concerned? Wouldn't this carry consequences
for say mod_wsgi, which also does this?
> Why do you think you need multiple interpreters, as opposed
> to one interpreter with multiple threads? If you're trying
> to sandbox the threads from each other and/or from the rest
> of the system, be aware that it's extremely difficult to
> securely sandbox Python code. You'd be much safer to run
> each one in its own process and rely on OS-level protections.
To allow each script to run in its own environment, with minimal chance
of inadvertent interaction between the environments, whilst allowing
each script the ability to stall on conditions that will be later met by
another thread supplying the information, and to fit in with existing
>> - I don't need to share objects between interpreters (if it is even
>> possible- I don't know).
> The hard part is *not* sharing objects between interpreters.
> If nothing else, all the builtin type objects, constants, etc.
> will be shared.
I understand. To clarify: I do not need to pass any Python objects I
create or receive back and forth between different interpreters. I can
imagine some environments would not react well to this.
PS. Apologies if any of these messages come through more than once. Most
lists that I've posted to set reply-to meaning a normal reply can be
used, but python-list does not seem to. The replies I have sent manually
to python-list at python.org instead don't seem to have appeared. I'm not
quite sure what is happening- apologies for any blundering around on my
part trying to figure it out.
More information about the Python-list