Uh oh!
There was an error while loading. Please reload this page.
bpo-45292: [PEP 654] Update traceback display code to work with exception groups - #29207
Conversation
iritkatriel
commented
Oct 25, 2021
This is almost exactly the same as I used for the PEP - I just removed the "with X sub-exceptions" line from the tracebacks because I think it clutters them and is not very useful. |
gvanrossum
commented
Oct 25, 2021
Just be sure to update the PEP examples. :-) |
bedevere-bot
commented
Oct 25, 2021
🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit 2052c77 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
bedevere-bot
commented
Oct 26, 2021
When you're done making the requested changes, leave the comment: |
erlend-aasland
left a comment
There was a problem hiding this comment.
First round comments :) I'll take a new round on references and pointers later.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
1st1
commented
Oct 27, 2021
I think it's OK to always box the EGs because they're pretty special, although I'd change the very first line of the output, from: to: |
iritkatriel
commented
Oct 27, 2021
@1st1 - see below.
The indentation of the next line is wrong. Is this a copy-paste error or a bug?
|
1st1
commented
Oct 27, 2021
Copy/paste/whitespace issue; no implementation bugs were observed! |
gvanrossum
left a comment
There was a problem hiding this comment.
I like the max_group_{with,depth} solution and the refactor of the chaining loop!
I didn't review the C code carefully, it looks like others are on that.
The only things left from me are nits in the formatting of some of the overflow messages. Otherwise LGTM!
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
bedevere-bot
commented
Nov 3, 2021
🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit 61fab3f 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
iritkatriel
commented
Nov 4, 2021
Thank you! @gpshead@erlend-aasland@1st1 I'll wait a bit before merging in case you want to have another look. |
There was a problem hiding this comment.
Looks good; great job!
The only remark I have is that I find the error handling verbose and hard to read. I'm used to (and prefer):
intfunc()
{
intrc=first();
if (rc<0) {
goto error;
}
interr=second();
if (err!=0) {
goto error;
}
// etc.// at the end:return0;
error:
cleanup();
return-1;
}The current approach of always verifying that the previous step did not fail seems to lead to a lot of indenting levels. I could count 7 (!) indents in one of the functions.
I would consider simplifying the error handling for the sake of readability.
Feel free to disregard this comment; It's only personal preference :)
iritkatriel
commented
Nov 4, 2021
@erlend-aasland I agree with your comment. I tried using gotos but it was a bit delicate because you need to make sure the refcounting is still correct. This is a refactor that should be done in its own PR and not together with major functional changes. The current method preserves the control flow so it doesn't impact refcounts. |
erlend-aasland
commented
Nov 4, 2021
+1 🙂 |
iritkatriel
commented
Nov 5, 2021
Thank you everyone for your help! |
| # format exception group | ||
| is_toplevel = (_ctx.exception_group_depth == 0) | ||
| if is_toplevel: | ||
| _ctx.exception_group_depth += 1 |
There was a problem hiding this comment.
FYI running patchcheck for an unrelated PR just complained about this 5-space indent!
(and more in Lib/traceback.py)
https://bugs.python.org/issue45292