Skip to content

Commit 5382c05

Browse files
authored
bpo-32351: Use fastpath in asyncio.sleep if delay<0 (#4908)
* Use fastpath in asyncio.sleep if delay<0 * Add NEWS entry
1 parent 44d1a59 commit 5382c05

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Lib/asyncio/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ def __sleep0():
503503

504504
async def sleep(delay, result=None, *, loop=None):
505505
"""Coroutine that completes after a given time (in seconds)."""
506-
if delay == 0:
506+
if delay <= 0:
507507
await __sleep0()
508508
return result
509509

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use fastpath in asyncio.sleep if delay<0 (2x boost)

0 commit comments

Comments
 (0)