Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
Prevent infinite loop when asyncio.sleep(0) is used in a loop (fixes #34
Browse files Browse the repository at this point in the history
)
  • Loading branch information
erdewit committed Sep 21, 2020
1 parent 32adc55 commit 9796f03
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nest_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ def _run_once(self):
handle = heappop(scheduled)
ready.append(handle)

while ready:
for _ in range(len(ready)):
if not ready:
break
handle = ready.popleft()
if not handle._cancelled:
handle._run()
Expand Down

0 comments on commit 9796f03

Please sign in to comment.