[issue16133] asyncore.dispatcher.recv doesn't handle EAGAIN / EWOULDBLOCK

Giampaolo Rodola' report at bugs.python.org
Thu May 2 02:30:50 CEST 2013


Giampaolo Rodola' added the comment:

recv() returning an empty string has always been an alias for "connection lost" though, that is why it cannot be used and I was proposing returning a new type in Python 3.4.

Point is we're paying a bad design decision: asyncore shouldn't have asked the user to call recv() directly in the first place and call a data_received(chunk) callback method instead.

Deciding what's best to do at this point without breaking existent code is not easy, that is why I think that on python <= 3.3 we should fix *asynchat* in order to take EAGAIN/EWOULDBLOCK into account and leave asyncore's recv() alone.
The issue would still exist but it would be mitigated by the fact that who wants to write a protocol is likely to use asynchat, not asyncore.

As for Python 3.4 we can:

- make asyncore's recv() return None and document it
- deprecate recv()
- introduce data_received(chunk)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16133>
_______________________________________


More information about the Python-bugs-list mailing list