[Python-Dev] Sharing between multiple interpreters and restricted mode

Jeremy Maxfield anothermax at gmail.com
Mon Jan 9 20:40:00 CET 2006


Hi Gabriel,

Apart from the problem of sharing code between interpreters (sounds
pretty dangerous to me) there's a bug in 2.4.1 (and 2.3.5 for that
matter) that causes problems with multiple interpreters in certain
siutations (esp. threads) which results in this 'restricted mode'
message - I encountered it when trying to do some work with JEP (Java
Embedded Python).
Python 2.4.2 fixed this problem for me.
I would suggest giving  2.4.2 a try too.

Good luck,
Max

On 1/4/06, Gabriel Becedillas <lists at core-sdi.com> wrote:
> Hi,
> At the company I work for we've embedded Python 2.4.1 in a C++
> application. We execute multiple scripts concurrenlty, each one in its
> own interpreter (created using Py_NewInterpreter()).
> We are sharing a certain instance between interpreters because its to
> expensive to instantiate that class every time an interpreter is
> created. The class is instantiated in the main interpreter (that is
> always alive) and every time a new interpreter is created, that
> instance is added to the interpreter's __builtins__ dict.
> The problem I'm having is that some methods of that class (when
> executed in an interpreter different from the one it was created in)
> complain about being in restricted execution mode.
> Assuming that there are no issues with this instance lifetime (coz it
> will always be referenced by the main interpreter), is there a safe way
> to do some sharing between interpreters ?.
> Thanks.
>
> --
>
> Gabriel Becedillas
> Developer
> CORE SECURITY TECHNOLOGIES
>
> Florida 141 - 2º cuerpo - 7º piso
> C1005AAC Buenos Aires - Argentina
> Tel/Fax: (54 11) 5032-CORE (2673)
> http://www.corest.com
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/anothermax%40gmail.com
>


More information about the Python-Dev mailing list