◐ Shell
clean mode source ↗

gh-141732: Fix `ExceptionGroup` repr changing when original exception sequence is mutated by dr-carlos · Pull Request #141736 · python/cpython

added 5 commits

November 19, 2025 16:27
…om reprs in `ComplexExtendsException`

@dr-carlos

iritkatriel

iritkatriel

picnixz

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>

iritkatriel pushed a commit that referenced this pull request

Dec 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 commit ff2577f)

Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>

thunze added a commit to thunze/nixpkgs that referenced this pull request

Feb 7, 2026
CPython fixed python/cpython#141732 in
python/cpython#141736, but exceptiongroup 1.3.1,
including its test suite, still matches the old repr behavior.
The CPython fix has only been backported to 3.13 so far, where it was
first included in version 3.13.12, so we only need to patch for 3.13
and 3.15+.

thunze added a commit to thunze/nixpkgs that referenced this pull request

Feb 7, 2026
CPython fixed python/cpython#141732 in
python/cpython#141736, but exceptiongroup 1.3.1,
including its test suite, still matches the old repr behavior.
The CPython fix has only been backported to 3.13 so far, where it was
first included in version 3.13.12, so we only need to patch for 3.13
and 3.15+.

thunze added a commit to thunze/nixpkgs that referenced this pull request

Feb 7, 2026

mweinelt pushed a commit to thunze/nixpkgs that referenced this pull request

Feb 8, 2026

nixpkgs-ci Bot pushed a commit to NixOS/nixpkgs that referenced this pull request

Feb 14, 2026

worksbyfriday added a commit to worksbyfriday/exceptiongroup that referenced this pull request

Feb 18, 2026
…mutated

Store a string representation of exceptions at creation time
(_exceptions_str) and use it in __repr__ instead of self.args[1],
which reflects mutations to the original mutable sequence.

This mirrors the CPython fix (python/cpython#141736) which was
backported to Python 3.13.12+. The test is version-conditional:
on Python < 3.11 (using the backport), it expects the fixed behavior;
on 3.11+ (using the builtin), it expects the behavior of that specific
CPython version.

Fixes agronholm#154.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

mdaniels5757 pushed a commit to NixOS/nixpkgs that referenced this pull request

Feb 25, 2026

ambv added a commit that referenced this pull request

Mar 23, 2026
…ption sequence is mutated (GH-141736) (GH-144445)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>

thunze added a commit to thunze/nixpkgs that referenced this pull request

Apr 9, 2026
[1] was finally backported to CPython 3.14 in [2], which landed in
CPython 3.14.4, causing the build of `python314Packages.exceptiongroup`
to fail.

In the meantime, exceptiongroup fixed `BaseExceptionGroup.__repr__` on
their end to match CPython behavior [3], so we can use that patch
instead.

[1] python/cpython#141736
[2] python/cpython#144445
[3] agronholm/exceptiongroup#155

thunze added a commit to thunze/nixpkgs that referenced this pull request

Apr 9, 2026
[1] was finally backported to CPython 3.14 in [2], which landed in
CPython 3.14.4, causing the build of `python314Packages.exceptiongroup`
to fail.

In the meantime, exceptiongroup fixed `BaseExceptionGroup.__repr__` on
their end to match CPython behavior [3], so we can use that patch
instead.

[1] python/cpython#141736
[2] python/cpython#144445
[3] agronholm/exceptiongroup#155

mweinelt pushed a commit to mweinelt/nixpkgs that referenced this pull request

Apr 9, 2026
[1] was finally backported to CPython 3.14 in [2], which landed in
CPython 3.14.4, causing the build of `python314Packages.exceptiongroup`
to fail.

In the meantime, exceptiongroup fixed `BaseExceptionGroup.__repr__` on
their end to match CPython behavior [3], so we can use that patch
instead.

[1] python/cpython#141736
[2] python/cpython#144445
[3] agronholm/exceptiongroup#155

mweinelt pushed a commit to mweinelt/nixpkgs that referenced this pull request

Apr 9, 2026
[1] was finally backported to CPython 3.14 in [2], which landed in
CPython 3.14.4, causing the build of `python314Packages.exceptiongroup`
to fail.

In the meantime, exceptiongroup fixed `BaseExceptionGroup.__repr__` on
their end to match CPython behavior [3], so we can use that patch
instead.

[1] python/cpython#141736
[2] python/cpython#144445
[3] agronholm/exceptiongroup#155

mweinelt pushed a commit to mweinelt/nixpkgs that referenced this pull request

Apr 9, 2026
[1] was finally backported to CPython 3.14 in [2], which landed in
CPython 3.14.4, causing the build of `python314Packages.exceptiongroup`
to fail.

In the meantime, exceptiongroup fixed `BaseExceptionGroup.__repr__` on
their end to match CPython behavior [3], so we can use that patch
instead.

[1] python/cpython#141736
[2] python/cpython#144445
[3] agronholm/exceptiongroup#155

mweinelt pushed a commit to mweinelt/nixpkgs that referenced this pull request

Apr 9, 2026
[1] was finally backported to CPython 3.14 in [2], which landed in
CPython 3.14.4, causing the build of `python314Packages.exceptiongroup`
to fail.

In the meantime, exceptiongroup fixed `BaseExceptionGroup.__repr__` on
their end to match CPython behavior [3], so we can use that patch
instead.

[1] python/cpython#141736
[2] python/cpython#144445
[3] agronholm/exceptiongroup#155

mweinelt pushed a commit to mweinelt/nixpkgs that referenced this pull request

Apr 10, 2026
[1] was finally backported to CPython 3.14 in [2], which landed in
CPython 3.14.4, causing the build of `python314Packages.exceptiongroup`
to fail.

In the meantime, exceptiongroup fixed `BaseExceptionGroup.__repr__` on
their end to match CPython behavior [3], so we can use that patch
instead.

[1] python/cpython#141736
[2] python/cpython#144445
[3] agronholm/exceptiongroup#155

salva09 pushed a commit to salva09/nixpkgs that referenced this pull request

May 7, 2026
[1] was finally backported to CPython 3.14 in [2], which landed in
CPython 3.14.4, causing the build of `python314Packages.exceptiongroup`
to fail.

In the meantime, exceptiongroup fixed `BaseExceptionGroup.__repr__` on
their end to match CPython behavior [3], so we can use that patch
instead.

[1] python/cpython#141736
[2] python/cpython#144445
[3] agronholm/exceptiongroup#155