`concurrent.interpreters.Interpreter.exec` propagate `SyntaxError`
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 35.9k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
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.ExecutionFailedthat correctly wraps aZeroDivisionError. - trying to execute
print 1causes a bareSyntaxError, whereas I would have expected a subclass ofinterpreters.InterpreterErrorwrapping 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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với việc triển khai concurrent.interpreters.Interpreter.exec và tái hiện hai đoạn mã trong báo cáo trên Python 3.14. Xác định cách xử lý dự kiến đối với SyntaxError so với ExecutionFailed, sau đó thêm hoặc cập nhật các bài kiểm thử tập trung để hành vi được rõ ràng và nhất quán.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- backend
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100