[New-bugs-announce] [issue31539] asyncio.sleep may sleep less time then it should
Mikhail
report at bugs.python.org
Thu Sep 21 03:52:58 EDT 2017
New submission from Mikhail:
Originally faced here:
https://stackoverflow.com/q/46306660/1113207
Simple code to reproduce:
import asyncio
import time
async def main():
while True:
asyncio.ensure_future(asyncio.sleep(1))
t0 = time.time()
await asyncio.sleep(0.1)
t1 = time.time()
print(t1 - t0)
if t1 - t0 < 0.1:
print('bug ^')
break
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
I thought that it may be related to event loop's internal clock, but changing time.time() with asyncio.get_event_loop().time() doesn't help.
Tested on Windows 10 x64, Python 3.6.2.
----------
components: asyncio
messages: 302671
nosy: germn, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.sleep may sleep less time then it should
type: behavior
versions: Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31539>
_______________________________________
More information about the New-bugs-announce
mailing list