Too wide location info for CHECK_EG_MATCH
未关闭
还没有人认领这个 Issue。
interpreter-core
type-bug
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
The line number of the instructions emitted for except* (CHECK_EG_MATCH etc) spans the entire except* body, and this shows up in the traceback when except* raises (e.g. when split() fails).
>>> class Bad(ExceptionGroup):
... def split(*args):
... 1/0
...
>>> try: raise Bad("", [ValueError(), TypeError()])
... except* ValueError:
... 1
... 2
... 3
...
+ Exception Group Traceback (most recent call last):
| File "<python-input-1>", line 1, in <module>
| try: raise Bad("", [ValueError(), TypeError()])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| Bad: (2 sub-exceptions)
+-+---------------- 1 ----------------
| ValueError
+---------------- 2 ----------------
| TypeError
+------------------------------------
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<python-input-1>", line 2, in <module>
except* ValueError:
...<2 lines>...
3
File "<python-input-0>", line 3, in split
1/0
~^~
ZeroDivisionError: division by zero
Linked PRs
- gh-129026
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用 issue 中的 except* 和 Bad.split() 示例重现 traceback,然后检查链接的 PR gh-129026 以了解实现背景。当 CHECK_EG_MATCH 位置不再覆盖整个 except* 主体,且显示的 traceback 仍然正确时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100