File tree Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -59,15 +59,13 @@ def _call_soon(func: Callable, *args: Any) -> Any:
59
59
partial (self .loop .run_in_executor , None ),
60
60
_call_soon ,
61
61
)
62
- except LifespanFailureError :
63
- # Lifespan failures should crash the server
62
+ except (LifespanFailureError , asyncio .CancelledError ):
64
63
raise
65
64
except (BaseExceptionGroup , Exception ) as error :
66
65
if isinstance (error , BaseExceptionGroup ):
67
- failure_error = error .subgroup (LifespanFailureError )
68
- if failure_error is not None :
69
- # Lifespan failures should crash the server
70
- raise failure_error
66
+ reraise_error = error .subgroup ((LifespanFailureError , asyncio .CancelledError ))
67
+ if reraise_error is not None :
68
+ raise reraise_error
71
69
72
70
self .supported = False
73
71
if not self .startup .is_set ():
Original file line number Diff line number Diff line change @@ -45,15 +45,13 @@ async def handle_lifespan(
45
45
trio .to_thread .run_sync ,
46
46
trio .from_thread .run ,
47
47
)
48
- except LifespanFailureError :
49
- # Lifespan failures should crash the server
48
+ except (LifespanFailureError , trio .Cancelled ):
50
49
raise
51
50
except (BaseExceptionGroup , Exception ) as error :
52
51
if isinstance (error , BaseExceptionGroup ):
53
- failure_error = error .subgroup (LifespanFailureError )
54
- if failure_error is not None :
55
- # Lifespan failures should crash the server
56
- raise failure_error
52
+ reraise_error = error .subgroup ((LifespanFailureError , trio .Cancelled ))
53
+ if reraise_error is not None :
54
+ raise reraise_error
57
55
58
56
self .supported = False
59
57
if not self .startup .is_set ():
You can’t perform that action at this time.
0 commit comments