File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -351,15 +351,15 @@ def from_call(
351351 (reraise ,) if not isinstance (reraise , tuple ) else reraise
352352 )
353353
354- # EG-aware path (only direct children; no nesting)
354+ # ExceptionGroup-aware path: check if any of the direct children
355+ # is an instance of the `reraise` parameter, and reraise the exception
356+ # accordingly (#13650).
355357 if isinstance (val , BaseExceptionGroup ):
356- exception_group = cast (BaseExceptionGroup , val )
357- for child in exception_group .exceptions :
358+ for child in val .exceptions :
358359 if isinstance (child , reraise_types ):
359- # B904: chain to the original exception we caught
360360 raise child from caught
361-
362- if isinstance (val , reraise_types ): # non-group or no match
361+ # Not an exception group, check if we need to reraise it.
362+ elif isinstance (val , reraise_types ):
363363 raise
364364
365365 result = None
You can’t perform that action at this time.
0 commit comments