Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
iritkatriel merged 45 commits intopython:mainfromdr-carlos:exception-group-repr
Dec 7, 2025

Conversation

@dr-carlos
Copy link
Contributor

@dr-carlosdr-carlos commentedNov 19, 2025
edited by github-actionsbot
Loading

  • BaseExceptionGroup.__repr__ now overridesBaseException.__repr__, using the group'sexception tuple 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__.

📚 Documentation preview 📚:https://cpython-previews--141736.org.readthedocs.build/

@iritkatriel
Copy link
Member

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 reacted with thumbs up emoji

@dr-carlos
Copy link
ContributorAuthor

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 - isc87b66b not a very similar change in this release without a PEP? But maybe I'm missing something :)

@iritkatriel
Copy link
Member

If you implementBaseExceptionGroup_repr so that the output doesn't change, then this change makes sense and can be merged and backported.

dr-carlos reacted with thumbs up emoji

dr-carlosand others added4 commitsNovember 23, 2025 07:46
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>
@dr-carlos
Copy link
ContributorAuthor

Is there anything blocking this PR?

I'll create an issue/PR updating docs to use tuples here (as suggested by@iritkatriel) once merged.

@iritkatrieliritkatriel added needs backport to 3.13bugs and security fixes needs backport to 3.14bugs and security fixes labelsDec 5, 2025
@iritkatrieliritkatrielenabled auto-merge (squash)December 5, 2025 11:07
@dr-carlos
Copy link
ContributorAuthor

Thanks! Not sure why the Android test is failing; but it seems unrelated to this PR.

@picnixz
Copy link
Member

We'll need to wait for#142365 to be merged so that we can bypass the flaky tests on iOS and Android

savannahostrowski and dr-carlos reacted with thumbs up emoji

@iritkatriel
Copy link
Member

There are some test failures preventing this being merged.

@iritkatrieliritkatriel merged commitff2577f intopython:mainDec 7, 2025
46 checks passed
@miss-islington-app
Copy link

Thanks@dr-carlos for the PR, and@iritkatriel for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestDec 7, 2025
…eption sequence is mutated (pythonGH-141736)(cherry picked from commitff2577f)Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
@miss-islington-app
Copy link

Sorry,@dr-carlos and@iritkatriel, I could not cleanly backport this to3.13 due to a conflict.
Please backport usingcherry_picker on command line.

cherry_picker ff2577f56eb2170ef0afafa90f78c693df7ca562 3.13
dr-carlos reacted with thumbs up emoji

@bedevere-app
Copy link

GH-142388 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelDec 7, 2025
@bedevere-app
Copy link

GH-142391 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelDec 7, 2025
@dr-carlosdr-carlos deleted the exception-group-repr branchDecember 7, 2025 23:04
iritkatriel pushed a commit that referenced this pull requestDec 8, 2025
…ption sequence is mutated (GH-141736) (#142391)* [3.13]gh-141732: Fix `ExceptionGroup` repr changing when original exception sequence is mutated (GH-141736)(cherry picked from commitff2577f)Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure⚠️⚠️⚠️

Hi! The buildbots390x Fedora Stable Refleaks 3.13 (tier-3) has failed when building commitd768900.

What do you need to do:

  1. Don't panic.
  2. Checkthe buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1662/builds/727) and take a look at the build logs.
  4. Check if the failure is related to this commit (d768900) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1662/builds/727

Failed tests:

  • test_import

Test leaking resources:

  • test_import: references
  • test_import: memory blocks

Summary of the results of the build (if available):

==

Click to see traceback logs
TracebackTests.test_exec_failure) ... okTracebackTests.test_broken_parent_from) ... okTracebackTests.test_exec_failure_nested) ... okTracebackTests.test_nonexistent_module_nested) ... okTracebackTests.test_broken_parent) ... okTracebackTests.test_import_bug) ... okTracebackTests.test_unencodable_filename) ... okTracebackTests.test_nonexistent_module) ... okTracebackTests.test_syntax_error) ... okTracebackTests.test_broken_submodule) ... okTracebackTests.test_broken_from) ... ok

@dr-carlos
Copy link
ContributorAuthor

Not sure why the buildbot is failing - had a look at the test output and the only thing I can find is

test_import leaked [1, 3, 0] references, sum=4 (this is fine)test_import leaked [1, 1, 6] memory blocks, sum=81 test failed again:    test_import

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
Copy link
Member

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 reacted with thumbs up emoji

@dr-carlos
Copy link
ContributorAuthor

dr-carlos commentedDec 10, 2025
edited
Loading

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.

Thanks for the heads up! I've tested locally with-R 3:3 and it passed, and the Buildbot seems to be running without errors again.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@iritkatrieliritkatrieliritkatriel approved these changes

@picnixzpicnixzpicnixz approved these changes

@willingcwillingcAwaiting requested review from willingc

@AA-TurnerAA-TurnerAwaiting requested review from AA-Turner

Assignees

@iritkatrieliritkatriel

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@dr-carlos@iritkatriel@picnixz@bedevere-bot

[8]ページ先頭

©2009-2026 Movatter.jp