bpo-32351: Use fastpath in asyncio.sleep if delay<0 (#4908)

* Use fastpath in asyncio.sleep if delay<0

* Add NEWS entry
This commit is contained in:
Andrew Svetlov 2017-12-17 16:41:30 +02:00 committed by GitHub
parent 44d1a5912e
commit 5382c05021
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -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

View file

@ -0,0 +1 @@
Use fastpath in asyncio.sleep if delay<0 (2x boost)