In REPL `dis.distb()` raise AttributeError when the previous input fails to compile
未關閉
還沒有人認領這個 Issue。
stdlib
topic-repl
type-bug
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 35.9k
- PR 合併指標
- PR 指標待擷取
描述
Bug report
Bug description:
in REPL input following sequentially
import dis- some invalid code
dis.distb()
>>> import dis
>>> ???
File "<stdin>", line 1
???
^
SyntaxError: invalid syntax
>>> dis.distb()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
dis.distb()
~~~~~~~~~^^
File "/home/dev/cpython/Lib/dis.py", line 150, in distb
while tb.tb_next: tb = tb.tb_next
^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'tb_next'
It looks like dis.distb() doesn’t handle the case where the previous exception’s traceback could be None in the REPL.
CPython versions tested on:
3.14, CPython main branch
Operating systems tested on:
Windows
Linked PRs
- gh-148317
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 Lib/dis.py 中 dis.distb() 附近的第 150 行開始,重現回報的 REPL 序列:import dis,輸入無效程式碼,然後呼叫 dis.distb()。在前面的編譯失敗之後,最終指令不再引發 AttributeError 即表示完成;開始前檢查連結的 gh-148317 工作。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- tooling
- Issue 類型
- 缺陷
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 35/100