What's wrong?

Fredrik Lundh fredrik at pythonware.com
Wed Jan 25 04:00:15 EST 2006


"kishkin" <kishkin at gmail.com> wrote:

> I wanted to write python script with defined function. From that script
> I wanted to call C module, which in it's turn call defined python
> function. Sounds simple. But I've got some troubles in realization. I'm
> beginner at python so it's normal, I think. :)
>
> Here's the code. I'll apreciate if anyone can answer me what's wrong
> here.

instead of letting everyone guess, maybe you could explain *why* you
think something's wrong with your code ?

(I suspect that if you try to write down what happens when you try
to compile and run this code, you'll figure out how to fix it all by your-
self)

</F>

> -------------------------------------------------------------------
> power.c:
>
> #include "Python.h"
>
> static PyObject *
> power(PyObject *self, PyObject *args)
> {
>   PyObject *result, *temp;
>
>   int num;
>
>   if (PyArg_ParseTuple(args, "iO", &num, &temp))
>   {
>     if (!PyCallable_Chack(temp))  //here's error, but I don't know
> why...
>     {
>       return NULL;
>     }
>   }

</F>






More information about the Python-list mailing list