S
sjh
I'm trying to write an extension for python 2.4, and I can't seem to
get PyArg_ParseTuple to work with a dict. I've tried all sorts of
things, but the most simple thing that fails is:
[...]
if (!PyArg_ParseTuple(args, "O", &file)) {
return NULL;
}
[...]
If I call the function from python with an int, or a string, etc it
works fine. If I pass in a dict I get:
SystemError: new style getargs format but argument is not a tuple
even though a call to:
PyObject_TypeCheck(args, &PyTuple_Type)
tells me that args is a tuple. PyObject_Print(args, stdout, NULL) even
produces:
({'foo': 1},)
Can anyone give me a minimal example of a C function that takes a dict
and parses it out with PyArg_ParseTuple?
-Seth
get PyArg_ParseTuple to work with a dict. I've tried all sorts of
things, but the most simple thing that fails is:
[...]
if (!PyArg_ParseTuple(args, "O", &file)) {
return NULL;
}
[...]
If I call the function from python with an int, or a string, etc it
works fine. If I pass in a dict I get:
SystemError: new style getargs format but argument is not a tuple
even though a call to:
PyObject_TypeCheck(args, &PyTuple_Type)
tells me that args is a tuple. PyObject_Print(args, stdout, NULL) even
produces:
({'foo': 1},)
Can anyone give me a minimal example of a C function that takes a dict
and parses it out with PyArg_ParseTuple?
-Seth