-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Description
This probably isn't too bad yet, but Python 3.11 finally will be out next month, and ExceptionGroup is already seeing growing usage across the ecosystem - for example in Pytest, Hypothesis, and Trio. Ideally we'd get this working soon, so that users who only rarely update are likely to have a compatible set of packages before they hit this interaction.
As a simple reproducing example:
try:
ExceptionGroup
except NameError:
from exceptiongroup import ExceptionGroup
# Realistically these errors would have their own nested tracebacks, but for simplicity...
raise ExceptionGroup("Multiple errors", [ValueError("msg"), TypeError("msg")])In the standard Python REPL, this shows:
>>> raise ExceptionGroup("Multiple errors", [ValueError("msg"), TypeError("msg")])
+ Exception Group Traceback (most recent call last):
| File "<stdin>", line 1, in <module>
| exceptiongroup.ExceptionGroup: Multiple errors (2 sub-exceptions)
+-+---------------- 1 ----------------
| ValueError: msg
+---------------- 2 ----------------
| TypeError: msg
+------------------------------------
but in IPython, or a Jupyter notebook, we only see the container exception:
In [2]: try:
...: ExceptionGroup
...: except NameError:
...: from exceptiongroup import ExceptionGroup
...:
...: raise ExceptionGroup("Multiple errors", [ValueError("msg"), TypeError("msg")])
---------------------------------------------------------------------------
ExceptionGroup Traceback (most recent call last)
Input In [3], in <cell line: 6>()
3 except NameError:
4 from exceptiongroup import ExceptionGroup
----> 6 raise ExceptionGroup("Multiple errors", [ValueError("msg"), TypeError("msg")])
ExceptionGroup: Multiple errors (2 sub-exceptions)honno, LIEWyiyi and ilotoki0804
Metadata
Metadata
Assignees
Labels
No labels