[ExceptionGroup] Inconsistent raise inside except* · Issue #103590 · python/cpython (original) (raw)
When raising inside except* block and the caught exception wasn't an ExceptionGroup originally, then raised exception doesn't get wrapped in ExceptionGroup:
try: try: raise TypeError(1) # prints ValueError(3) raise ExceptionGroup('', [TypeError(2)]) # prints ExceptionGroup('', [ValueError(3)]) except* TypeError: raise ValueError(3) except BaseException as e: print(repr(e))