diff options
author | Guido van Rossum <guido@python.org> | 2007-08-03 22:27:51 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-08-03 22:27:51 (GMT) |
commit | c2de7c03a05eb59ff03f07ea799d0c33abad6cc8 (patch) | |
tree | 68cfe1a6404eadcd19004d694e50097fda74821a /Modules/socketmodule.c | |
parent | 4a7fd90d9c963581489215ff2ae0fc593cffc440 (diff) | |
download | cpython-c2de7c03a05eb59ff03f07ea799d0c33abad6cc8.zip cpython-c2de7c03a05eb59ff03f07ea799d0c33abad6cc8.tar.gz cpython-c2de7c03a05eb59ff03f07ea799d0c33abad6cc8.tar.bz2 |
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.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r-- | Modules/socketmodule.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index f6f577e..d9e9844 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -2193,6 +2193,10 @@ sock_recv_guts(PySocketSockObject *s, char* cbuf, int len, int flags) 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 @@ sock_recv_into(PySocketSockObject *s, PyObject *args, PyObject *kwds) 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, |