mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	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.
This commit is contained in:
		
							parent
							
								
									4a7fd90d9c
								
							
						
					
					
						commit
						c2de7c03a0
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		| 
						 | 
					@ -2193,6 +2193,10 @@ sock_recv_guts(PySocketSockObject *s, char* cbuf, int len, int flags)
 | 
				
			||||||
		select_error();
 | 
							select_error();
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					        if (len == 0) {
 | 
				
			||||||
 | 
							/* If 0 bytes were requested, do nothing. */
 | 
				
			||||||
 | 
							return 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef __VMS
 | 
					#ifndef __VMS
 | 
				
			||||||
	Py_BEGIN_ALLOW_THREADS
 | 
						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,
 | 
						if (!PyArg_ParseTupleAndKeywords(args, kwds, "w#|ii:recv_into", kwlist,
 | 
				
			||||||
					 &buf, &buflen, &recvlen, &flags))
 | 
										 &buf, &buflen, &recvlen, &flags))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	assert(buf != 0 && buflen > 0);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (recvlen < 0) {
 | 
						if (recvlen < 0) {
 | 
				
			||||||
		PyErr_SetString(PyExc_ValueError,
 | 
							PyErr_SetString(PyExc_ValueError,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue