-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Open
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
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
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error