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

@ -5972,12 +5972,14 @@ socket_getnameinfo(PyObject *self, PyObject *args)
"getnameinfo() argument 1 must be a tuple");
return NULL;
}
if (!PyArg_ParseTuple(sa, "si|II",
if (!PyArg_ParseTuple(sa, "si|II;getnameinfo(): illegal sockaddr argument",
&hostp, &port, &flowinfo, &scope_id))
{
return NULL;
}
if (flowinfo > 0xfffff) {
PyErr_SetString(PyExc_OverflowError,
"getsockaddrarg: flowinfo must be 0-1048575.");
"getnameinfo(): flowinfo must be 0-1048575.");
return NULL;
}
PyOS_snprintf(pbuf, sizeof(pbuf), "%d", port);