[Cython] Cannot coerce list to type 'list'
Muhammad Alkarouri
malkarouri at gmail.com
Thu Dec 18 01:25:18 CET 2008
On Dec 17, 2008, Robert Bradshaw wrote:
> What is the definition of list in c_python? If it's a cdef extern
> class of the actual python list, then this is a bug and should work.
> Also, you might not need c_python anymore.
Thanks, that does the trick.
The __builtin__.list was cdef extern in the c_python.pxd (shown
below), I simply commented it and the code worked fine.
Is there a fault with how I have it written, or should I report it as a bug now?
# -*- Mode: Python -*- Not really, but close enough
# Expose as much of the Python C API as we need here
cdef extern from "stdlib.h":
ctypedef int size_t
cdef extern from "Python.h":
ctypedef int Py_intptr_t
void* PyMem_Malloc(size_t)
void* PyMem_Realloc(void *p, size_t n)
void PyMem_Free(void *p)
char* PyString_AsString(object string)
object PyString_FromString(char *v)
object PyString_InternFromString(char *v)
int PyErr_CheckSignals()
object PyFloat_FromDouble(double v)
void Py_XINCREF(object o)
void Py_XDECREF(object o)
void Py_CLEAR(object o) # use instead of decref
ctypedef class __builtin__.dict [object PyDictObject]:
pass
ctypedef class __builtin__.list [object PyListObject]:
pass
Regards,
Muhammad Alkarouri
More information about the Cython-dev
mailing list