This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients gvanrossum, martin.panter, sbstp, vstinner, yselivanov
Date 2016-02-21.07:41:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1456040462.94.0.273139833972.issue26395@psf.upfronthosting.co.za>
In-reply-to
Content
If your event loop supports it, maybe you could use add_reader() etc as a workaround (roughly based off a different function of my own; this version completely untested):

async def sock_recvfrom(nonblocking_sock, *pos, loop, **kw):
    while True:
        try:
            return nonblocking_sock.recvfrom(*pos, **kw)
        except BlockingIOError:
            future = Future(loop=loop)
            loop.add_reader(nonblocking_sock.fileno(), future.set_result, None)
            try:
                await future
            finally:
                loop.remove_reader(nonblocking_sock.fileno())

I’m not very experienced with asyncio, but I imagine having general-purpose loop.wait_readable(file_descriptor) etc methods would make writing these kind of functions easier.
History
Date User Action Args
2016-02-21 07:41:03martin.pantersetrecipients: + martin.panter, gvanrossum, vstinner, yselivanov, sbstp
2016-02-21 07:41:02martin.pantersetmessageid: <1456040462.94.0.273139833972.issue26395@psf.upfronthosting.co.za>
2016-02-21 07:41:02martin.panterlinkissue26395 messages
2016-02-21 07:41:02martin.pantercreate