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

@ -562,8 +562,15 @@ _io_IncrementalNewlineDecoder_setstate(nldecoder_object *self,
PyObject *buffer;
unsigned long long flag;
if (!PyArg_ParseTuple(state, "OK", &buffer, &flag))
if (!PyTuple_Check(state)) {
PyErr_SetString(PyExc_TypeError, "state argument must be a tuple");
return NULL;
}
if (!PyArg_ParseTuple(state, "OK;setstate(): illegal state argument",
&buffer, &flag))
{
return NULL;
}
self->pendingcr = (int) (flag & 1);
flag >>= 1;