Include the opening brace's line in multiline f-string errors
まだ誰も着手していません。
評価
調査の方向性
提供された複数行 f-string の再現コードから始め、その診断結果を期待されるメッセージと比較します。対応する t-string のケースを確認し、置換フィールド内の有効な文字列が引き続き機能することを確認します。影響を受ける両方のエラーメッセージが開き波括弧の行を示し、有効な文字列を壊さないことが完了の条件です。リンクされた pull request はすでに一覧にあります。
索引モデルが issue の本文から書いたものです。
説明
An unclosed f-string replacement field can report an error on a later line, making the opening brace hard to find:
var = "abc"
a = f""" {var} extern "C" { """
b = """ string """
File "script.py", line 3
b = """ string """
^
SyntaxError: f-string: expecting '}'
The quotes after the second { start a string inside the replacement field. That string ends on line 3, and the final quotes start another string that is never closed.
The error should include the line number of the opening brace:
SyntaxError: f-string: expecting '}' to close '{' on line 2
The same problem affects t-strings. Valid strings inside replacement fields should continue to work.
Linked PRs
- gh-157779
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 36k
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 558
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
python/cpython のほかの issue
-
docs pending
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
stdlib type-feature
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
stdlib type-feature
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
build type-bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
stdlib topic-email type-feature
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
🐛 Bug 🔔 Pending processing
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
jumpserver/jumpserver#17584 ·