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