Too wide location info for CHECK_EG_MATCH
Open
Nobody has claimed this yet.
interpreter-core
type-bug
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the traceback with the except* and Bad.split() example in the issue, then inspect linked PR gh-129026 for the implementation context. Done means the CHECK_EG_MATCH location no longer spans the entire except* body and the shown traceback remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100