You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Should it show the number of immediate subexceptions (i.e., len(eg.exceptions)) or the number of leaf exceptions? I'd be happy with the former (since that's what EdgeDb's MultiError does), which would not require adding an extra field to the base exception group struct.
Activity
iritkatriel commentedon Feb 12, 2022
The str() of exception groups currently contains just the msg as passed to the constructor. This turned out to be confusing (see #31270 (comment)).
We should consider whether it is possible to design a more informative str().
Note that the str() is included in the standard traceback, which include the line:
f"{type(e)}: {str(e)}"
So str() should not repeat the type, and should not clutter this too much. Probably just the msg plus the number of contained leaf exceptions.
PEP-654 needs to be updated with what we do here, and the change needs to be approved by the SC.
gvanrossum commentedon Feb 12, 2022
Should it show the number of immediate subexceptions (i.e., len(eg.exceptions)) or the number of leaf exceptions? I'd be happy with the former (since that's what EdgeDb's MultiError does), which would not require adding an extra field to the base exception group struct.
iritkatriel commentedon Feb 22, 2022
New changeset 38b5acf by Irit Katriel in branch 'main':
bpo-46729: add number of sub-exceptions in str() of BaseExceptionGroup (GH-31294)
38b5acf