Skip to content

Commit

Permalink
bpo-32351: Use fastpath in asyncio.sleep if delay<0 (#4908)
Browse files Browse the repository at this point in the history
* Use fastpath in asyncio.sleep if delay<0

* Add NEWS entry
  • Loading branch information
asvetlov authored Dec 17, 2017
1 parent 44d1a59 commit 5382c05
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Lib/asyncio/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def __sleep0():

async def sleep(delay, result=None, *, loop=None):
"""Coroutine that completes after a given time (in seconds)."""
if delay == 0:
if delay <= 0:
await __sleep0()
return result

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use fastpath in asyncio.sleep if delay<0 (2x boost)

0 comments on commit 5382c05

Please sign in to comment.