Andrew Svetlov <[email protected]> added the comment:
A task should have `await` inside to give to loop a chance to switch to another
task (or get canceled).
It is not an asyncio bug but a part of specified behavior.
Your code could be modified as
async def readdev(dev):
while True:
buf=os.read(dev, 480)
print([struct.unpack('llHHi', buf[i*24:(i+1)*24]) for i in
range(len(buf)//24)])
await asyncio.sleep(0)
to use tasks switching
----------
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35481>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com