PyInline Released: Put C source code directly "inline" with your Python!

Thomas Heller thomas.heller at ion-tof.com
Fri Aug 31 14:29:31 EDT 2001


> The question is, what I am doing wrong here (or is it allowed at all)?
>
> ############ simple test code ##################
> from PyInline import C
>
> x = C.Builder(code="""
> PyObject* test_pyobj(PyObject *self, PyObject *args) {
>   int t;
>   if (!PyArg_ParseTuple(args, "i", &t))
>         return NULL;
>   return Py_BuildValue("i", t*2) ;
> }
>
> """)
PyInline probably tries to wrap your function (which is not
needed because it is already wrapped). You should examine
the generated source-code.

>From the docs (I haven't tried it) it seems you should write:
x = C.Builder(code="""
int times_two(int t) {
    return t*2;
}
""")

Thomas





More information about the Python-list mailing list