Multiple simultaneous Python interpreters

Michael Hudson mwh at
Thu Mar 20 12:01:34 CET 2003

"White Flame \(aka David Holz\)" <whiteflame52 at> writes:

> "Peter Hansen" <peter at> wrote in message
> news:3E78C112.48015ABE at
> > Perhaps you're overestimating your need for independence in the multiple
> > instances?  Have you considered whether that's absolutely necessary for
> > your design?
> Yes, it is absolutely necessary.  Independence is crucial for the ability to
> kill off and clean up a runaway script (ie, one that is adding elements to a
> dictionary in an infinite loop) without taking down the application or other
> simultaneously running scripts.  Plus, various interpreters should have
> different import functionality available to them, giving various "sandbox"
> models.  These are 2 fundamental points to the design.

I (and I guess others) am still a touch confused about why you can use
your OS's segregation facility, which is to say multiple processes.

But given that, you could try Py_InterpreterNew.  The code doesn't get
excercised all that much, so there may be the odd gremlin, but it
basically works and if you're doing hard-core things like stack
quotas, fixing such bugs as come up shouldn't seem that difficult :-)


42. You can measure a programmer's perspective by noting his
    attitude on the continuing vitality of FORTRAN.
  -- Alan Perlis,

More information about the Python-list mailing list