Skip to content

Commit 6e5f468

Browse files
committed
Use is_closed() instead of catching the error
1 parent bcd5ab8 commit 6e5f468

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

trio_asyncio/_loop.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,10 +417,8 @@ async def async_main(*args):
417417

418418
@sync_nursery.start_soon
419419
async def wait_for_sync():
420-
try:
420+
if not loop.is_closed():
421421
await loop.synchronize()
422-
except RuntimeError: # "Event loop is closed"
423-
pass
424422
sync_nursery.cancel_scope.cancel()
425423

426424
await loop.wait_stopped()

0 commit comments

Comments
 (0)