gh-139551: add support for BaseExceptionGroup in IDLE#139563
gh-139551: add support for BaseExceptionGroup in IDLE#139563gpshead merged 15 commits intopython:mainfrom
Conversation
|
The change that |
picnixz
left a comment
There was a problem hiding this comment.
Can you add tests and a What's New entry as well? I think the code could also avoid having all those if prefix: inside the for loops and many times, the additional string is either two spaces or the given prefix.
Misc/NEWS.d/next/IDLE/2025-10-04-22-34-06.gh-issue-139551.hJDxw6.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
|
More generally, don't we have a helper in |
Maybe not. In IDLE, it need |
|
Ok. For now, let's write it as is, and later we can rewrite the exception rendering logic by using the same approach as for |
|
I have no idea whether to do it. What should be used is |
|
No, I meant, we should mimic this ourselves. We may need to tweak the context itself, but the approach can be taken. Not in this PR though I would say as it may be too much changes in one PR. |
|
I encounter exactly this issue all the time, sorry to bother again but @gpshead could you look at this as well whenever you have time? |
The print call for the "exception has printed" message in print_exc_group was writing to stdout instead of stderr. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The expression need_print_underline *= (i == len(exc.exceptions)) used bool*bool as a substitute for logical and. Replace with a readable conditional. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Test nested groups, __cause__/__context__ chaining inside groups, and cycle detection for the exception group display code. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…up rendering Match the traceback module defaults (max_group_width=15, max_group_depth=10) to prevent pathological exception groups from producing unbounded output or stack overflow via recursion. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gpshead
left a comment
There was a problem hiding this comment.
I polished things a little & added tests, this should be ready, it appears to work as expected.
pie in the sky: I do wish idle didn't reinvent its own exception rendering and could just use the traceback module - but if it even makes sense to do that (it may not), it'd be an entirely different cleanup.

Uh oh!
There was an error while loading. Please reload this page.