Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4facdf5

Browse files
orenmnserhiy-storchaka
authored andcommitted
bpo-31311: Impove error reporting in case the first argument to PyCData_setstate() isn't a dictionary. (#3255)
1 parent 2b382dd commit 4facdf5

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Modules/_ctypes/_ctypes.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2665,8 +2665,11 @@ PyCData_setstate(PyObject *myself, PyObject *args)
26652665
int res;
26662666
PyObject *dict, *mydict;
26672667
CDataObject *self = (CDataObject *)myself;
2668-
if (!PyArg_ParseTuple(args, "Os#", &dict, &data, &len))
2668+
if (!PyArg_ParseTuple(args, "O!s#",
2669+
&PyDict_Type, &dict, &data, &len))
2670+
{
26692671
return NULL;
2672+
}
26702673
if (len > self->b_size)
26712674
len = self->b_size;
26722675
memmove(self->b_ptr, data, len);

0 commit comments

Comments
 (0)