bpo-31311: Impove error reporting in case the first argument to PyCData_setstate() isn't a dictionary. (#3255)
This commit is contained in:
parent
2b382dd612
commit
4facdf523a
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue