Author asvetlov
Recipients asvetlov, youngchaos, yselivanov
Date 2018-12-13.13:30:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1544707845.12.0.788709270274.issue35481@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2018-12-13 13:30:45asvetlovsetrecipients: + asvetlov, yselivanov, youngchaos
2018-12-13 13:30:45asvetlovsetmessageid: <1544707845.12.0.788709270274.issue35481@psf.upfronthosting.co.za>
2018-12-13 13:30:45asvetlovlinkissue35481 messages
2018-12-13 13:30:44asvetlovcreate