Regression: 3.13 `traceback.format_list()` breaking behavior change.
オープン
まだ誰も着手していません。
docs
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
Bug description:
traceback.format_list() no longer works with lines that have breaks in them:
import traceback
import sys
print(f"Python {sys.version_info.major}.{sys.version_info.minor}")
# Frame with multiline text (source + variable annotations)
frames = [('test.py', 10, 'func', 'x = foo + bar\n\t\thello\n\tworld')]
print("\nInput (3 lines):")
print(repr(frames[0][3]))
print("\nOutput from traceback.format_list():")
result = traceback.format_list(frames)[0] # Yes, it't always a 1-element list both on 3.12 adn 3.13.
print(result)
Python 3.12
Input (3 lines):
'x = foo + bar\n\t\thello\n\tworld'
Output from traceback.format_list():
File "test.py", line 10, in func
x = foo + bar
hello
world
Python 3.13
Input (3 lines):
'x = foo + bar\n\t\thello\n\tworld'
Output from traceback.format_list():
File "test.py", line 10, in func
x = foo + bar
This broke bettre_exceptions on 3.13, which was fixed by formatting the traceback manually. Can we either
- Revert to old behavior in 3.15 and maybe document that it was broken in 3.13 and 3.14?
- Document the behavior change?
ref: https://github.com/Qix-/better-exceptions/issues/134
CPython versions tested on:
3.13
Operating systems tested on:
No response
Linked PRs
- gh-153469
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提供されたスクリプトを Python 3.12 と 3.13 で再現し、次に traceback.format_list() から調査を始めます。互換性を意図しているのか、ドキュメント化を意図しているのかを判断する前に、リンクされた PR gh-153469 と traceback 周辺の挙動を確認してください。受け入れられた挙動が実装または文書化され、複数行のケースが関連するテストでカバーされていれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100