PyArg_ParseTuple
with O
arguments expects a pointer to a PyObject *
, not a pointer to a PyObject
(i.e. the variadic argument should be of type PyObject **
).
So your code should be:
char const *fmt = "OO";
PyObject *dict1, *dict2;
if (!PyArg_ParseTuple(args, fmt, &dict1, &dict2))
return NULL;
int hasDict1 = PyDict_Check(dict1);
int hasDict2 = PyDict_Check(dict2);
// ...