summaryrefslogtreecommitdiffstats
path: root/Modules/_io
diff options
context:
space:
mode:
authorOren Milman <orenmn@gmail.com>2017-08-20 15:35:36 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-08-20 15:35:36 (GMT)
commit1d1d3e9db882d78433f5bc8dbe7df929f4b6b5e1 (patch)
treeb5d3ee0a0aba15a2586c4e891630554dd702e933 /Modules/_io
parent4bfebc63012f0f4e00f6a98c3d96e1c0ebe93408 (diff)
downloadcpython-1d1d3e9db882d78433f5bc8dbe7df929f4b6b5e1.zip
cpython-1d1d3e9db882d78433f5bc8dbe7df929f4b6b5e1.tar.gz
cpython-1d1d3e9db882d78433f5bc8dbe7df929f4b6b5e1.tar.bz2
bpo-28261: Fixed err msgs where PyArg_ParseTuple is used to parse normal tuples. (#3119)
Diffstat (limited to 'Modules/_io')
-rw-r--r--Modules/_io/textio.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
index b5d368a..57b66d6 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -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;