I am trying to embed a c function in my python script for a first time.
When I try to call it I get an error
SystemError: new style getargs format but argument is not a tuple
Guido said on some mailing list, that it is probably an effect of the
lack of METH_VARARGS in the functions' array
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
zefciu wrote:
I am trying to embed a c function in my python script for a first
time. When I try to call it I get an error
SystemError: new style getargs format but argument is not a tuple
Guido said on some mailing list, that it is probably
Thinker wrote:
zefciu wrote:
I am trying to embed a c function in my python script for a first
time. When I try to call it I get an error
SystemError: new style getargs format but argument is not a tuple
Guido said on some mailing list, that it is probably an effect of
the lack
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
zefciu wrote:
I am trying to embed a c function in my python script for a first
time. When I try to call it I get an error
SystemError: new style getargs format but argument is not a tuple
Guido said on some mailing list, that it is probably
Thinker wrote:
It should be PyObject *coord; .
Maybe, it is what is wrong with your program!
Should it? The gcc shows me a warning then:
warning: 'coord' is used uninitialized in this function
and during the execution I get the same error *plus* a segfault.
zefciu
--
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
zefciu wrote:
Thinker wrote:
It should be PyObject *coord; . Maybe, it is what is wrong with
your program!
Should it? The gcc shows me a warning then:
warning: 'coord' is used uninitialized in this function
and during the execution I get
Thinker wrote:
You can add some printf() to throw out messages to make sure where the
program stop at.
If you can compile the module with debug information and use gdb to
backtrace dump file,
it would be useful.
Did it. The arguments are parsed, but the coord tuple isn't. But can
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
zefciu wrote:
Thinker wrote:
You can add some printf() to throw out messages to make sure
where the program stop at. If you can compile the module with
debug information and use gdb to backtrace dump file, it would be
useful.
Did it. The
Thinker wrote:
Since PyArg_ParseTuple() is supposed to parse arguments, I recommand you
to use PyTuple_GetItem() or PyTuple_GET_ITEM().
Ok. Now I do it this way:
c_real = PyFloat_AsDouble(PyTuple_GetItem(coord,0));
c_imag = PyFloat_AsDouble(PyTuple_GetItem(coord,1));
And it worked... once.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
zefciu wrote:
Thinker wrote:
Since PyArg_ParseTuple() is supposed to parse arguments, I
recommand you to use PyTuple_GetItem() or PyTuple_GET_ITEM().
Ok. Now I do it this way:
c_real = PyFloat_AsDouble(PyTuple_GetItem(coord,0)); c_imag =
zefciu wrote:
Ok. Now I do it this way:
c_real = PyFloat_AsDouble(PyTuple_GetItem(coord,0));
c_imag = PyFloat_AsDouble(PyTuple_GetItem(coord,1));
And it worked... once. The problem is really funny - in the interactive
the function fails every second time.
mandelpixel((1.5, 1.5), 9,
Ziga Seilnacht wrote:
The second example uses your approach and is a bit more cumbersome,
but still works. Could you post your current version of the code?
I don't understand where your problem could be.
I think, there's no need to. Now I understand :)
if (!PyArg_ParseTuple(args, Oid,
12 matches
Mail list logo