Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34k
gh-141732: FixExceptionGroup 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 ourterms of service andprivacy 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
iritkatriel commentedNov 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 commentedNov 20, 2025
Thanks for the quick response! That all makes sense. Just to clarify - isc87b66b not a very similar change in this release without a PEP? But maybe I'm missing something :) |
iritkatriel commentedNov 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 <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This reverts commit4801399.
dr-carlos commentedDec 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 commentedDec 5, 2025
Thanks! Not sure why the Android test is failing; but it seems unrelated to this PR. |
picnixz commentedDec 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 commentedDec 7, 2025
There are some test failures preventing this being merged. |
ff2577f intopython: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 commitff2577f)Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
Sorry,@dr-carlos and@iritkatriel, I could not cleanly backport this to |
GH-142388 is a backport of this pull request to the3.14 branch. |
GH-142391 is a backport of this pull request to the3.13 branch. |
bedevere-bot commentedDec 8, 2025
|
dr-carlos commentedDec 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 commentedDec 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 commentedDec 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 |
Uh oh!
There was an error while loading.Please reload this page.
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/