Reputation: 2750
Description of problem:
When I call method defined like this:
static PyMethodDef Parser_methods[] = {
{"read", (PyCFunction)Parser_read, METH_KEYWORDS, "read from input source"},
{NULL, NULL, 0, NULL}
};
static PyObject *
Parser_read(Parser * const self, PyObject * unused0, PyObject * unused1)
{
...
}
I got:
SystemError: Bad call flags in PyCFunction_Call. METH_OLDARGS is no longer supported!
The code works fine on Python2, but crashes on Python3
Upvotes: 2
Views: 2170
Reputation: 10064
Could be this bug...
http://bugs.python.org/issue11587
Which means it's a python version issue. One fix seems to be to use METH_KEYWORDS | METH_VARARGS
.
Upvotes: 3
Reputation: 10064
Parser_read
should be
static PyObject* Parser_read(PyObject *self, PyObject *args)
Upvotes: 0