code: use current excinfo when formatting chained BaseExceptionGroup by bysiber · Pull Request #14221 · pytest-dev/pytest
In repr_excinfo, the BaseExceptionGroup branch incorrectly uses the original excinfo instead of excinfo_ (which tracks the current exception in the chain). This means that when walking __cause__ or __context__ chains, filter_excinfo_traceback and format_exception always operate on the first exception rather than the current one. The non-group branch on the else side already uses excinfo_ correctly.
Test that when a BaseExceptionGroup appears as a chained exception, the traceback output correctly shows both the ExceptionGroup and the outer exception, using the current excinfo_ rather than the original.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters