diff options
Diffstat (limited to 'Lib/test/support/interpreters.py')
-rw-r--r-- | Lib/test/support/interpreters.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Lib/test/support/interpreters.py b/Lib/test/support/interpreters.py index 3b50161..5aba369 100644 --- a/Lib/test/support/interpreters.py +++ b/Lib/test/support/interpreters.py @@ -91,12 +91,26 @@ class Interpreter: """ return _interpreters.destroy(self._id) + # XXX Rename "run" to "exec"? def run(self, src_str, /, *, channels=None): """Run the given source code in the interpreter. - This blocks the current Python thread until done. + This is essentially the same as calling the builtin "exec" + with this interpreter, using the __dict__ of its __main__ + module as both globals and locals. + + There is no return value. + + If the code raises an unhandled exception then a RunFailedError + is raised, which summarizes the unhandled exception. The actual + exception is discarded because objects cannot be shared between + interpreters. + + This blocks the current Python thread until done. During + that time, the previous interpreter is allowed to run + in other threads. """ - _interpreters.run_string(self._id, src_str, channels) + _interpreters.exec(self._id, src_str, channels) def create_channel(): |