diff Modules/socketmodule.c @ 42439:71304efbc316

Get rid of a bogus assert when recv_into() is called with a zero-length buffer. We just return 0 in this case now, like for all zero-length reads.
author Guido van Rossum <guido@python.org>
date Fri, 03 Aug 2007 22:27:51 +0000
parents e70cdce0e8b2
children 043a102a170e
line wrap: on
line diff
--- a/Modules/socketmodule.c	Fri Aug 03 21:15:23 2007 +0000
+++ b/Modules/socketmodule.c	Fri Aug 03 22:27:51 2007 +0000
@@ -2193,6 +2193,10 @@
 		select_error();
 		return -1;
 	}
+        if (len == 0) {
+		/* If 0 bytes were requested, do nothing. */
+		return 0;
+	}
 
 #ifndef __VMS
 	Py_BEGIN_ALLOW_THREADS
@@ -2322,7 +2326,6 @@
 	if (!PyArg_ParseTupleAndKeywords(args, kwds, "w#|ii:recv_into", kwlist,
 					 &buf, &buflen, &recvlen, &flags))
 		return NULL;
-	assert(buf != 0 && buflen > 0);
 
 	if (recvlen < 0) {
 		PyErr_SetString(PyExc_ValueError,