mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
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:
parent
44d1a5912e
commit
5382c05021
2 changed files with 2 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Use fastpath in asyncio.sleep if delay<0 (2x boost)
|
Loading…
Add table
Add a link
Reference in a new issue