SystemError: new style getargs format but argument is not a tuple

zefciu zefirek at Speacock.Pau.Apoznan.Mpl
Mon Feb 26 13:14:53 EST 2007


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.  The problem is really funny - in the interactive
the function fails every second time.

>>> mandelpixel((1.5, 1.5), 9, 2.2)
args parsed
coord parsed
ii3
>>> mandelpixel((1.5, 1.5), 9, 2.2)
TypeError: bad argument type for built-in operation
>>> mandelpixel((1.5, 1.5), 9, 2.2)
args parsed
coord parsed
ii3
>>> mandelpixel((1.5, 1.5), 9, 2.2)
TypeError: bad argument type for built-in operation

etcaetera.... (the "args parsed" "coord parsed" and "i" are effect of
printfs in the code, as you see when it fails, it doesn't even manage to
parse the arguments.

zefciu



More information about the Python-list mailing list