bpo-28261: Fixed err msgs where PyArg_ParseTuple is used to parse normal tuples. (#3119)

This commit is contained in:
Oren Milman 2017-08-20 18:35:36 +03:00 committed by Serhiy Storchaka
parent 4bfebc6301
commit 1d1d3e9db8
8 changed files with 67 additions and 19 deletions

View file

@ -990,7 +990,9 @@ parse_address(PyObject *obj, SOCKADDR *Address, int Length)
((SOCKADDR_IN*)Address)->sin_port = htons(Port);
return Length;
}
else if (PyArg_ParseTuple(obj, "uHkk", &Host, &Port, &FlowInfo, &ScopeId))
else if (PyArg_ParseTuple(obj,
"uHkk;ConnectEx(): illegal address_as_bytes "
"argument", &Host, &Port, &FlowInfo, &ScopeId))
{
PyErr_Clear();
Address->sa_family = AF_INET6;
@ -1024,8 +1026,11 @@ Overlapped_ConnectEx(OverlappedObject *self, PyObject *args)
BOOL ret;
DWORD err;
if (!PyArg_ParseTuple(args, F_HANDLE "O", &ConnectSocket, &AddressObj))
if (!PyArg_ParseTuple(args, F_HANDLE "O!:ConnectEx",
&ConnectSocket, &PyTuple_Type, &AddressObj))
{
return NULL;
}
if (self->type != TYPE_NONE) {
PyErr_SetString(PyExc_ValueError, "operation already attempted");