Skip to content

Commit 9051214

Browse files
committed
drop two isinstance tests from the main loop
1 parent f76a5bc commit 9051214

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

trio_asyncio/base.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ async def synchronize(self):
432432
433433
"""
434434
w = trio.Event()
435-
self._queue_handle(w)
435+
self._queue_handle(Handle(w.set,(),self, is_sync=True))
436436
await w.wait()
437437

438438
# Signal handling #
@@ -679,20 +679,12 @@ async def _main_loop_one(self, no_wait=False):
679679
# so restart from the beginning.
680680
return
681681

682-
if isinstance(obj, trio.Event):
683-
# Events are used for synchronization.
684-
# Simply set them.
685-
if obj is self._stopped:
686-
raise StopAsyncIteration
687-
obj.set()
688-
return
689-
690682
if isinstance(obj, TimerHandle):
691683
# A TimerHandle is added to the list of timers.
692684
heapq.heappush(self._timers, obj)
693685
return
694686

695-
assert isinstance(obj, asyncio.Handle)
687+
# assert isinstance(obj, asyncio.Handle) # speed-up
696688
# Hopefully one of ours
697689
# but it might be a standard asyncio handle
698690

0 commit comments

Comments
 (0)