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

STINNER Victor report at bugs.python.org
Fri Jun 27 23:01:43 CEST 2014


STINNER Victor added the comment:

Modifying recv() to return None doesn't look correct. I read it as: "you should always use recv() output, except if the result is None: in this case, do nothing". In Python, we use exceptions for that. BUT in fact, sock.recv() already raises an exception, so asyncore should not convert the exception to a magic value (None).

Modifying the behaviour of recv() in asyncore breaks the backward compatibility. Returning None makes it harder to write asyncore code working on Python 3.4 and 3.5 (if the change is done in Python 3.5).

I prefer EWOULDBLOCK.patch approach: document the issue in asyncore documentation and handle BlockingIOError in asynchat.

----------

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


More information about the Python-bugs-list mailing list