-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Open
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesdocsDocumentation in the Doc dirDocumentation in the Doc dirtopic-subinterpreters
Description
Bug report
Bug description:
Hi,
I am testing the concurrent.interpreters feature from Python 3.14rc3 (the latest current rc).
The subinterpreter seems to behave in a surprising way when encountering syntax errors. For example, in the following code:
from concurrent import interpreters
interpr = interpreters.create()
def exec_catching_errors(code: str) -> None:
try:
interpr.exec(code)
except interpreters.ExecutionFailed as e:
print(f"There was an error: {e}")
print("The function ends")
exec_catching_errors("print(1/0)")
exec_catching_errors("print 1") # this is the surprising line
# the whole script dies with an uncaught SyntaxError
- trying to execute
print(1/0)
causes aninterpreters.ExecutionFailed
that correctly wraps aZeroDivisionError
. - trying to execute
print 1
causes a bareSyntaxError
, whereas I would have expected a subclass ofinterpreters.InterpreterError
wrapping theSyntaxError
.
Is this intended behaviour, a bug, or something that simply needs to be better documented?
Thanks
CPython versions tested on:
3.14
Operating systems tested on:
Linux
Metadata
Metadata
Assignees
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesdocsDocumentation in the Doc dirDocumentation in the Doc dirtopic-subinterpreters
Projects
Status
Todo
Status
Todo