File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -440,8 +440,9 @@ def aiotrio_run(
440440 pass_not_threadsafe : bool = True ,
441441 ** start_guest_run_kwargs : Any ,
442442) -> T :
443+ loop = asyncio .new_event_loop ()
444+
443445 async def aio_main () -> T :
444- loop = asyncio .get_running_loop ()
445446 trio_done_fut : asyncio .Future [Outcome [T ]] = loop .create_future ()
446447
447448 def trio_done_callback (main_outcome : Outcome [T ]) -> None :
@@ -460,7 +461,12 @@ def trio_done_callback(main_outcome: Outcome[T]) -> None:
460461
461462 return (await trio_done_fut ).unwrap ()
462463
463- return asyncio .run (aio_main ())
464+ try :
465+ # can't use asyncio.run because that fails on Windows (3.8, x64, with
466+ # Komodia LSP)
467+ return loop .run_until_complete (aio_main ())
468+ finally :
469+ loop .close ()
464470
465471
466472def test_guest_mode_on_asyncio () -> None :
You can’t perform that action at this time.
0 commit comments