Reputation: 21
My PyFLoat_ParseTuple
call always return false, with correct call from python side.
I am working on wrapping my C++ for Python and using python extension.
I had a successful project, and generating the current one based on that.
I always had a crash in my python run, and during the investigation I reduced my code to the following minim code to repeat it.
If I change both C++/Python side to non-arg call, it works as expected. But the "Parse error" is always printed when I passed in args.
C++:
static PyObject *myfunc(PyObject *self, PyObject *args)
{
float v[6];
if (!PyArg_ParseTuple(args, "ffffff", v,v+1,v+2,v+3,v+4,v+5));
{
//I can alway see this prited.
cerr<<"Parse error\n";
return NULL;
}
return PyString_FromFormat("No error!\n");
}
Python:
print func(0.1,0.2,0.3,0.4,0.5,0.6)
Upvotes: 1
Views: 206
Reputation: 1293
a very simple typo:
if (!PyArg_ParseTuple(args, "ffffff", v,v+1,v+2,v+3,v+4,v+5));
- see the semicolon ;
at the end of if
?
Upvotes: 1