Hi,

I am testing the 
[concurrent.interpreters](https://docs.python.org/3.14/library/concurrent.interpreters.html)
 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:

```python
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 an interpreters.ExecutionFailed that 
correctly wraps a ZeroDivisionError.
- trying to execute "print 1" causes a bare SyntaxError, whereas I would have 
expected a subclass of interpreters.InterpreterError wrapping the SyntaxError.

Is this intended behaviour, a bug, or something that simply needs to be better 
documented?

Thanks



Note: I have also posted this question at 
https://github.com/python/cpython/issues/139324. This is my first interaction 
with the python devel community and I do not know which is the preferred 
channel, sorry for the cross post.
-- 
https://mail.python.org/mailman3//lists/python-list.python.org

Reply via email to