Repository navigation
Commit 43226e1
Fix ExceptionGroup repr changing when original exception sequence is 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>1 parent 2cba843 commit 43226e1
2 files changed
Lines changed: 19 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
| |||
275 | 276 | | |
276 | 277 | | |
277 | 278 | | |
278 | | - | |
| 279 | + | |
279 | 280 | | |
280 | 281 | | |
281 | 282 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
882 | 882 | | |
883 | 883 | | |
884 | 884 | | |
885 | | - | |
886 | | - | |
887 | | - | |
888 | | - | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
0 commit comments