Garthy wrote:
I am running into problems when using multiple interpreters [1] 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. 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.
- I understand that for the most part only a single interpreter will be running at a time due to the GIL.
Yes, as far as I can tell, there is only one GIL in a given process.
- 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. -- Greg -- https://mail.python.org/mailman/listinfo/python-list