mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #5421: merge fix
This commit is contained in:
commit
9befeb3743
2 changed files with 19 additions and 6 deletions
|
@ -40,6 +40,8 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #5421: Fix misleading error message when one of socket.sendto()'s
|
||||||
|
arguments has the wrong type. Patch by Nikita Vetoshkin.
|
||||||
|
|
||||||
- Issue #10979: unittest stdout buffering now works with class and module
|
- Issue #10979: unittest stdout buffering now works with class and module
|
||||||
setup and teardown.
|
setup and teardown.
|
||||||
|
|
|
@ -2747,17 +2747,28 @@ sock_sendto(PySocketSockObject *s, PyObject *args)
|
||||||
Py_buffer pbuf;
|
Py_buffer pbuf;
|
||||||
PyObject *addro;
|
PyObject *addro;
|
||||||
char *buf;
|
char *buf;
|
||||||
Py_ssize_t len;
|
Py_ssize_t len, arglen;
|
||||||
sock_addr_t addrbuf;
|
sock_addr_t addrbuf;
|
||||||
int addrlen, n = -1, flags, timeout;
|
int addrlen, n = -1, flags, timeout;
|
||||||
|
|
||||||
flags = 0;
|
flags = 0;
|
||||||
if (!PyArg_ParseTuple(args, "y*O:sendto", &pbuf, &addro)) {
|
arglen = PyTuple_Size(args);
|
||||||
PyErr_Clear();
|
switch (arglen) {
|
||||||
if (!PyArg_ParseTuple(args, "y*iO:sendto",
|
case 2:
|
||||||
&pbuf, &flags, &addro))
|
PyArg_ParseTuple(args, "y*O:sendto", &pbuf, &addro);
|
||||||
return NULL;
|
break;
|
||||||
|
case 3:
|
||||||
|
PyArg_ParseTuple(args, "y*iO:sendto",
|
||||||
|
&pbuf, &flags, &addro);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
PyErr_Format(PyExc_TypeError,
|
||||||
|
"sendto() takes 2 or 3 arguments (%d given)",
|
||||||
|
arglen);
|
||||||
}
|
}
|
||||||
|
if (PyErr_Occurred())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
buf = pbuf.buf;
|
buf = pbuf.buf;
|
||||||
len = pbuf.len;
|
len = pbuf.len;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue