8000 gh-76785: Support Running Some Functions in Subinterpreters by ericsnowcurrently · Pull Request #110251 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-76785: Support Running Some Functions in Subinterpreters #110251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Next Next commit
Update the Interpreter.run() docstring.
  • Loading branch information
ericsnowcurrently committed Oct 2, 2023
commit c3a669edb6d84ebd725fb02f6f96acf96156cc4f
15 changes: 14 additions & 1 deletion Lib/test/support/interpreters.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,20 @@ def close(self):
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)

Expand Down
0