Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
dr-carlos commented Nov 19, 2025 • edited by github-actions bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by github-actions bot
Uh oh!
There was an error while loading. Please reload this page.
iritkatriel commented Nov 19, 2025
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). |
dr-carlos commented Nov 20, 2025
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 :) |
iritkatriel commented Nov 20, 2025
If you implement |
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.
Co-authored-by: Bénédikt Tran <[email protected]>
Co-authored-by: Bénédikt Tran <[email protected]>
This reverts commit 4801399.
dr-carlos commented Dec 5, 2025
Is there anything blocking this PR? I'll create an issue/PR updating docs to use tuples here (as suggested by @iritkatriel) once merged. |
dr-carlos commented Dec 5, 2025
Thanks! Not sure why the Android test is failing; but it seems unrelated to this PR. |
picnixz commented Dec 7, 2025
We'll need to wait for #142365 to be merged so that we can bypass the flaky tests on iOS and Android |
iritkatriel commented Dec 7, 2025
There are some test failures preventing this being merged. |
ff2577f into python:mainUh oh!
There was an error while loading. Please reload this page.
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 ff2577f) 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. |
bedevere-bot commented Dec 8, 2025
|
dr-carlos commented Dec 9, 2025
Not sure why the buildbot is failing - had a look at the test output and the only thing I can find is And I don't know enough about the import tests to know whether this is a problem (and whether this PR has anything to do with it). |
iritkatriel commented Dec 10, 2025
It's a problem - this is the reference leak test (something was not decref'ed). Entirely possible that it's not related to your PR. I kicked off the test again to see if it's intermittent. You can run this test locally with -R3:3. |
dr-carlos commented Dec 10, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Thanks for the heads up! I've tested locally with |
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/