[Python-3000-checkins] r56719 - python/branches/py3k-struni/Modules/socketmodule.c

guido.van.rossum python-3000-checkins at python.org
Sat Aug 4 00:27:52 CEST 2007


Author: guido.van.rossum
Date: Sat Aug  4 00:27:51 2007
New Revision: 56719

Modified:
   python/branches/py3k-struni/Modules/socketmodule.c
Log:
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.


Modified: python/branches/py3k-struni/Modules/socketmodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/socketmodule.c	(original)
+++ python/branches/py3k-struni/Modules/socketmodule.c	Sat Aug  4 00:27:51 2007
@@ -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,


More information about the Python-3000-checkins mailing list