`concurrent.interpreters.Interpreter.exec` propagate `SyntaxError`
オープン
まだ誰も着手していません。
3.14
3.15
docs
topic-subinterpreters
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
concurrent.interpreters.Interpreter.exec の実装から始め、Python 3.14 でレポートにある 2 つのコードスニペットを再現します。SyntaxError と ExecutionFailed をどのように扱うべきかを確認し、その後、動作が明示的かつ一貫したものになるよう、焦点を絞ったテストを追加または更新します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- backend
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100