
On Mon, Sep 11, 2017 at 8:51 AM, Nick Coghlan <ncoghlan@gmail.com> wrote:
On 10 September 2017 at 04:04, Nathaniel Smith <njs@pobox.com> wrote:
On Sep 8, 2017 4:06 PM, "Eric Snow" <ericsnowcurrently@gmail.com> wrote:
run(code):
Run the provided Python code in the interpreter, in the current OS thread. If the interpreter is already running then raise RuntimeError in the interpreter that called ``run()``.
The current interpreter (which called ``run()``) will block until the subinterpreter finishes running the requested code. Any uncaught exception in that code will bubble up to the current interpreter.
This phrase "bubble up" here is doing a lot of work :-). Can you elaborate on what you mean? The text now makes it seem like the exception will just pass from one interpreter into another, but that seems impossible – it'd mean sharing not just arbitrary user defined exception classes but full frame objects...
Indeed, I think this will need to be something more akin to https://docs.python.org/3/library/subprocess.html# subprocess.CalledProcessError, where the child interpreter is able to pass back encoded text data (perhaps including a full rendered traceback), but the exception itself won't be able to be propagated.
It would be helpful if at least the exception type could somehow be preserved / restored / mimicked. Otherwise you need if-elif statements in your try-excepts and other annoying stuff. -- Koos -- + Koos Zevenhoven + http://twitter.com/k7hoven +