Giampaolo Rodola' <g.rod...@gmail.com> added the comment: I've never used socket.socket.makefile so I'm not sure, but its documentation says:
> The socket must be in blocking mode (it can not have a timeout). If the statement is there because EAGAIN/EWOULDBLOCK were originally raised then it should be removed, otherwise I question whether makefile() is actually supposed to support non-blocking sockets in the first place. IMO, I think it's a matter of figuring out whether makefile() should provide a socket-like behavior or a file like-behavior first. In the first case I would expect all errors be raised as if I'm dealing with a common socket, otherwise they should be silenced/handled internally or makefile() just fail immediately as there's not such thing as "non-blocking files". > Instead, readinto() should detect the blocking condition (EAGAIN / > EWOULDBLOCK) and > return None (same for write(), I imagine). io.RawIOBase.readinto doc says: > Read up to len(b) bytes into bytearray b and return the number of bytes read. ...so returning 0 instead of None looks more natural to me. Same for write, also because: >>> open('xxx', 'w').write('') 0 I've also noticed that socket.SocketIO.readinto has a while loop which continues in case of EINTR and that's something which should be removed in case makefile() actually intends to support non-blocking sockets. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9854> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com