agronholm / exceptiongroup

Backport of PEP 654 (exception groups)
Other
42 stars 20 forks source link

Subgroup is omitted from rendering when in a loop with its parent group #35

Closed gschaffner closed 2 years ago

gschaffner commented 2 years ago

To reproduce (tested on CPython 3.9 and 3.10):

e0 = Exception("e0")
eg0 = ExceptionGroup("eg0", (e0,))
eg1 = ExceptionGroup("eg1", (eg0,))

raise eg0 from eg1

gives

  | exceptiongroup.ExceptionGroup: eg1 (1 sub-exception)

The above exception was the direct cause of the following exception:

  + Exception Group Traceback (most recent call last):
  |   File "/home/ganden/vc/exceptiongroup/eg.py", line 7, in <module>
  |     raise eg0 from eg1
  | exceptiongroup.ExceptionGroup: eg0 (1 sub-exception)
  +-+---------------- 1 ----------------
    | Exception: e0
    +------------------------------------

This differs from the expected 3.11 behavior.