summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/asyncio/tasks.py2
-rw-r--r--Misc/NEWS.d/next/Library/2017-12-17-14-23-23.bpo-32351.95fh2K.rst1
2 files changed, 2 insertions, 1 deletions
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py
index cdb483a..275141c 100644
--- a/Lib/asyncio/tasks.py
+++ b/Lib/asyncio/tasks.py
@@ -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
diff --git a/Misc/NEWS.d/next/Library/2017-12-17-14-23-23.bpo-32351.95fh2K.rst b/Misc/NEWS.d/next/Library/2017-12-17-14-23-23.bpo-32351.95fh2K.rst
new file mode 100644
index 0000000..56f52d2
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2017-12-17-14-23-23.bpo-32351.95fh2K.rst
@@ -0,0 +1 @@
+Use fastpath in asyncio.sleep if delay<0 (2x boost)