-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The default unraisablehook implementation does not print chained exceptions or recurse into exception groups #95572
Comments
Looks like the default unraisable hook has its own implementation of exception printing. Why isn't it just calling |
looks like the threading.excepthook does the right thing:
|
if this is a bug in unraisable hook can we get the fix backported to 3.10 so the exceptiongroup backport can use it? |
I don't know if this is a bug or an enhancement. In any case it's hookable, right? |
I don't think back porting this even could affect the exception group backport - in 3.10 |
The default unraisablehook doesn't print chained exceptions either. I think this may be deliberate to avoid recursion when the interpreter could be in a delicate state (e.g. under memory pressure). This is definitely not a bugfix. I'm removing 3.11. |
in the backport if I delete the custom
|
Yes, but then the normal tracebacks will probably have the strs of the nested exceptions twice. |
I've seen a fair bit of code that does I think the normal tracebacks should change how ExceptionGroup is printed and the |
We can't keep the default How are you proposing to change the normal tracebacks? |
How many is too many? Ideally exceptions wouldn't be printed and instead go via the traceback formatter, but sometimes that's not possible, so the last resort is to print them all
The normal tracebacks wouldn't change in appearance, I'm suggesting they special case ExceptionGroup outright Specifically they would not call This is particularly handy because we can do this in the backport |
What if you subclassed ExceptionGroup and redefined str? |
I would honestly close this as "won't fix". I don't see the point of spending the resources on trying to improve this corner case without making things more fragile. |
I agree, this is hookable so anyone can implement what they need anyway. |
here's a demo in the repl
@vstinner @iritkatriel I'm not sure if this is an omission or by design, but if an exception with critical debug advice is raised in an exceptiongroup during
__del__
I can't see the type or error messageI expected the output to include:
The text was updated successfully, but these errors were encountered: