File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -680,10 +680,14 @@ def _spawn(
680680 message; `Context.run` makes the spawned handler inherit that context.
681681 """
682682 assert self ._tg is not None
683+
684+ async def run () -> None :
685+ await fn (* args )
686+
683687 if sender_ctx is not None :
684- sender_ctx .run (self ._tg .start_soon , fn , * args )
688+ sender_ctx .run (self ._tg .start_soon , run )
685689 else :
686- self ._tg .start_soon (fn , * args )
690+ self ._tg .start_soon (run )
687691
688692 def _fan_out_closed (self ) -> None :
689693 """Wake every pending `send_raw_request` waiter with `CONNECTION_CLOSED`.
Original file line number Diff line number Diff line change @@ -444,7 +444,10 @@ async def die_late() -> None:
444444 process .exit (0 )
445445
446446 # The grace wait starts when stdin closes; anchor the death there.
447- process .on_stdin_close = lambda : tg .start_soon (die_late )
447+ def schedule_death () -> None :
448+ tg .start_soon (die_late )
449+
450+ process .on_stdin_close = schedule_death
448451 # no branch: the tracer drops this nested async-with's arcs under
449452 # trio's MockClock even though the body runs.
450453 async with stdio_client (FAKE_PARAMS ): # pragma: no branch
You can’t perform that action at this time.
0 commit comments