-----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 = > 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 I guess it is caused by ill handling reference count of coord. You should call Py_INCREF() to get a reference since it is borrowed from PyArg_ParseTuple(). You can find more information at http://docs.python.org/ext/refcounts.html
- -- Thinker Li - [EMAIL PROTECTED] [EMAIL PROTECTED] http://heaven.branda.to/~thinker/GinGin_CGI.py -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF4yuP1LDUVnWfY8gRAqOmAJ0SaIwpnRk/GZYm2Z5nnC7xH7EYKwCgjz8o 0Z/S7i5PULQMeAFI7U/Cy5I= =4C3l -----END PGP SIGNATURE-----
-- http://mail.python.org/mailman/listinfo/python-list