New submission from Irit Katriel <iritkatr...@gmail.com>:

The str() of exception groups currently contains just the msg as passed to the 
constructor. This turned out to be confusing (see 
https://github.com/python/cpython/pull/31270#issuecomment-1036418346).

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.

----------
components: Interpreter Core
keywords: 3.2regression
messages: 413121
nosy: iritkatriel
priority: normal
severity: normal
status: open
title: Better str() for BaseExceptionGroup
versions: Python 3.11

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46729>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to