Found while working with #14781.
When an ExceptionGroup is raised from another exception, the cause is printed twice in the traceback output. This is the same root cause as #8321, but the BaseExceptionGroup branch in repr_excinfo() was missed.
Minimal example:
def test_repro():
try:
raise RuntimeError("original cause")
except RuntimeError as exc:
raise ExceptionGroup("group", [ValueError("inner")]) from exc
RuntimeError: original cause and the "The above exception was the direct cause" line appear twice: once from traceback.format_exception() (see #9159) walking __cause__ itself, and once more from pytest's chain-walking loop.
Environment
- 9.2.0.dev117+g2886fc64b.d20260729
- Python 3.14.3
- Windows
Packages
- attrs: 25.4.0
- exceptiongroup: 1.3.1
- iniconfig: 2.3.0
- packaging: 26.0
- pluggy: 1.6.0
- pytest: 9.2.0.dev117+g2886fc64b.d20260729
Found while working with #14781.
When an
ExceptionGroupis raised from another exception, the cause is printed twice in the traceback output. This is the same root cause as #8321, but theBaseExceptionGroupbranch inrepr_excinfo()was missed.Minimal example:
RuntimeError: original causeand the"The above exception was the direct cause"line appear twice: once fromtraceback.format_exception()(see #9159) walking__cause__itself, and once more from pytest's chain-walking loop.Environment
Packages