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(
351
351
(reraise ,) if not isinstance (reraise , tuple ) else reraise
352
352
)
353
353
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).
355
357
if isinstance (val , BaseExceptionGroup ):
356
- exception_group = cast (BaseExceptionGroup , val )
357
- for child in exception_group .exceptions :
358
+ for child in val .exceptions :
358
359
if isinstance (child , reraise_types ):
359
- # B904: chain to the original exception we caught
360
360
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 ):
363
363
raise
364
364
365
365
result = None
You can’t perform that action at this time.
0 commit comments