"kishkin" wrote: > :)) O? course it PyCallable_Check there!!! :)) And error is that > PyCallable_Check returned 0. > > power.c compiles without errors. > > error is here: > ----------------------------------- > [EMAIL PROTECTED] 1]$ make -f makefile.power > gcc power.c -g -I/usr/local/include/python2.4 -fpic -shared -o power.so > [EMAIL PROTECTED] 1]$ python power.py > Exception exceptions.TypeError: 'argument list must be a tuple' in > 'garbage collection' ignored > Fatal Python error: enexpected exception during garbage collection
enexpected? are you typing things in by hand, or does your computer have a bad RAM chip ? > Aborted > ----------------------------------- try changing result = Py_BuildValue("i", num*num); PyEval_CallObject(temp, result); Py_DECREF(result); to result = Py_BuildValue("(i)", num*num); PyEval_CallObject(temp, result); Py_DECREF(result); or, more convenient result = PyObject_CallFunction(temp, "i", num*num); if (!result) return NULL; (note that you don't really need to check for callables; the CallFunction API will do that for you, and generate a proper exception if you pass in the wrong thing). </F> -- http://mail.python.org/mailman/listinfo/python-list