[Python-checkins] bpo-31311: Impove error reporting in case the first argument to PyCData_setstate() isn't a dictionary. (#3255)
Serhiy Storchaka
webhook-mailer at python.org
Sun Sep 24 05:21:44 EDT 2017
https://github.com/python/cpython/commit/4facdf523aa6967487a9425f124da9661b59fd43
commit: 4facdf523aa6967487a9425f124da9661b59fd43
branch: master
author: Oren Milman <orenmn at gmail.com>
committer: Serhiy Storchaka <storchaka at gmail.com>
date: 2017-09-24T12:21:42+03:00
summary:
bpo-31311: Impove error reporting in case the first argument to PyCData_setstate() isn't a dictionary. (#3255)
files:
M Modules/_ctypes/_ctypes.c
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 1942c63c815..8afb8cc1f16 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -2665,8 +2665,11 @@ PyCData_setstate(PyObject *myself, PyObject *args)
int res;
PyObject *dict, *mydict;
CDataObject *self = (CDataObject *)myself;
- if (!PyArg_ParseTuple(args, "Os#", &dict, &data, &len))
+ if (!PyArg_ParseTuple(args, "O!s#",
+ &PyDict_Type, &dict, &data, &len))
+ {
return NULL;
+ }
if (len > self->b_size)
len = self->b_size;
memmove(self->b_ptr, data, len);
More information about the Python-checkins
mailing list