[Python-Dev] Fixing send()

Guido van Rossum guido@python.org
Thu, 25 Oct 2001 10:59:34 -0400


I'm planning to add a sendall() method to the socket object.  See the
SF patch:

http://sf.net/tracker/index.php?func=detail&aid=474307&group_id=5470&atid=305470

If you have an objection, please let me know.  I think this is
important enough to bypass the feature freeze -- it's the best way to
fix the very real bug (on FreeBSD) of unchecked send() calls.  (The
alternative would be to add a loop to every use of send().)

The sendall() call allows us to fix the standard library modules that
currently don't check for send()'s return value, without breaking any
existing code, by changing sock.send(data) into sock.sendall(data).
Other alternatives intended to fix the problem of unchecked send()
calls in standard library module without having to change all send()
calls were deemed to dangerous (see the SF patch discussion).

I think Anthony is going to add this to the 2.1.2 bugfix release as
well -- with the same argument for breaking the feature freeze.

--Guido van Rossum (home page: http://www.python.org/~guido/)