[issue20951] SSLSocket.send() returns 0 for non-blocking socket

Ben Darnell report at bugs.python.org
Wed Mar 26 02:53:57 CET 2014


Ben Darnell added the comment:

Giampaolo, where do you see that send() may return zero if the other side has closed?  I've always gotten an error in that case (EPIPE)

I vote -1 to adding a new flag to control whether it returns zero or raises and +0 to just fixing it in Python 3.5 (I don't think returning zero is an unreasonable thing to do; it's not obvious to me from send(2) that it is guaranteed to never return zero although I believe that to be the case).  It'll break Tornado, but there will be plenty of time to get a fix out before then.  If there were a convenient place to put a deprecation warning I'd vote to deprecate in 3.5 and fix in 3.6, but there's no good way for the application to signal that it expects a WANT_WRITE exception.

Another option may be to have SSLSocket.send() convert the WANT_WRITE exception into a socket.error with errno EAGAIN.  This wouldn't break Tornado and would make socket.send and SSLSocket.send more consistent, but it's weird to hide the true error like this.

----------
nosy: +Ben.Darnell

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


More information about the Python-bugs-list mailing list