-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
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
base: main
Are you sure you want to change the base?
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 <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This reverts commit 4801399.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
|
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
|
Currently we're using |
|
I have made the requested changes; please review again |
|
Thanks for making the requested changes! @picnixz, @iritkatriel: please review the changes made to this pull request. |
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/