-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
gh-141732: Fix ExceptionGroup repr changing when original exception sequence is mutated
#141736
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
Conversation
|
Thanks. We don't make user-visible changes to builtin types without a PEP, so this PR cannot be merged as is. We could document current behaviour (i.e., don't mutate the list) if it's not clear from the docs and then consider if we want to change it. If we do want to change it, maybe it should be to make a shallow copy of the list rather than make it a tuple (so the repr/str won't change and break existing code that relies on current behaviour). |
Thanks for the quick response! That all makes sense. Just to clarify - is c87b66b not a very similar change in this release without a PEP? But maybe I'm missing something :) |
|
If you implement |
Co-authored-by: Bénédikt Tran <[email protected]>
Co-authored-by: Bénédikt Tran <[email protected]>
This reverts commit 4801399.
…n `test_repr_raises()`
picnixz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
|
Is there anything blocking this PR? I'll create an issue/PR updating docs to use tuples here (as suggested by @iritkatriel) once merged. |
|
Thanks! Not sure why the Android test is failing; but it seems unrelated to this PR. |
|
We'll need to wait for #142365 to be merged so that we can bypass the flaky tests on iOS and Android |
|
There are some test failures preventing this being merged. |
|
Thanks @dr-carlos for the PR, and @iritkatriel for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
…eption sequence is mutated (pythonGH-141736) (cherry picked from commit ff2577f56eb2170ef0afafa90f78c693df7ca562) Co-authored-by: dr-carlos <[email protected]>
|
Sorry, @dr-carlos and @iritkatriel, I could not cleanly backport this to |
|
GH-142388 is a backport of this pull request to the 3.14 branch. |
|
GH-142391 is a backport of this pull request to the 3.13 branch. |
|
BaseExceptionGroup.__repr__now overridesBaseException.__repr__, using the group'sexceptiontuple instead of the mutable argument passed in.ComplexExtendsException(a private macro inObjects/exceptions.c) now has a parameter to modify the exception's__repr__and not just its__str__.ExceptionGrouprepr is misleading if original exception sequence is mutated #141732📚 Documentation preview 📚: https://cpython-previews--141736.org.readthedocs.build/