Multiple simultaneous Python interpreters

Michael Hudson mwh at python.net
Thu Mar 20 06:01:34 EST 2003


"White Flame \(aka David Holz\)" <whiteflame52 at y.a.h.o.o.com> writes:

> "Peter Hansen" <peter at engcorp.com> wrote in message
> news:3E78C112.48015ABE at engcorp.com...
> > 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 :-)

Cheers,
M.

-- 
42. You can measure a programmer's perspective by noting his
    attitude on the continuing vitality of FORTRAN.
  -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html




More information about the Python-list mailing list