[Python-ideas] In-process interpreters

Dima Tisnek dimaqq at gmail.com
Tue Nov 30 08:14:14 CET 2010


Perhaps you can clarify what exactly you want to do.
I can see at least 2 distict cases

1. Multithreaded web server (or even browser)
* interpreters need separate imports
  at least pure python modules should be loaded and unloaded,
  different versions of same python modules could be used by different
interpreters
  if different versions of C extensions are needed, different dynamic
loading might be needed
  btw, is it still the case that C extensions cannot be unloaded?
* interpreters need separate memory regions
  so that individual interpreters can be killed quickly

2. Long-running process that executes many small independent user
scripts (e.g. phone)
* memory could be shared as long as cross-references are forbidden
  garbage collector hopefully kill circular references after
interpreter is terminated
* long-running process might want to reload a C extension, ouch
* a possible workaround would be execute only one interpreter at a time,
  somehow pickling user script state?



More information about the Python-ideas mailing list