GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||
GeezerVison is showing github.com — GH-146096: Fix base exception group repr by sergey-miryanov · Pull Request #146141 · python/cpython Conversation
|
|
Thanks for the fix @sergey-miryanov! All looks good to me. It's a pity that we don't preserve the list-like repr ( |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| * with self.exceptions. Instead, use self.exceptions for accuracy, | ||
| * making it look like self.args[1] for backwards compatibility. */ | ||
| if (PyList_Check(PyTuple_GET_ITEM(self->args, 1))) { | ||
| if (PyTuple_GET_SIZE(self->args) == 2 && PyList_Check(PyTuple_GET_ITEM(self->args, 1))) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check that it's a Tuple first?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
No, args is always converted to a tuple in its setter:
https://github.com/sergey-miryanov/cpython/blob/4f9a6ba7ba98a83d5594aacadcddb90696ffd5d7/Objects/exceptions.c#L351-L364
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Could add an assert just so it reads like it makes sense.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'm not sure that failed test related to change. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Thanks all! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The cause of the segfault, #141732, was backported to 3.13 & 3.14. The reproducer crashes on both: eg = ExceptionGroup("msg", [ValueError()]) eg.args = () # repr of the ExceptionGroup with empty args should not crash print(repr(eg), "ExceptionGroup('msg', (ValueError(),))") I'll backport the fix there. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @sergey-miryanov for the PR, and @iritkatriel for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @sergey-miryanov for the PR, and @iritkatriel for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-156903 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-156904 is a backport of this pull request to the 3.14 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…GH-156904) (cherry picked from commit ced6460) Co-authored-by: Sergey Miryanov <[email protected]>
…GH-156903) (cherry picked from commit ced6460) Co-authored-by: Sergey Miryanov <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.