2012/4/22 Nathan Dunfield <n...@illinois.edu>: > With Cython 0.15, the following works with Python 2.7: > > ### start file: prob.pyx > > def f(x): > cdef int* p > return eval(x) > > ### end file > >>>> import pyximport; pyximport.install() >>>> import prob >>>> prob.f("5") > 5 > > but with Cython 0.16 it doesn't even compile: > >>>> import prob > > Error compiling Cython file: > ------------------------------------------------------------ > ... > def f(x): > cdef int* p > return eval(x) > ^ > ------------------------------------------------------------ > > prob.pyx:3:15: Cannot convert 'int *' to Python object > > If I comment out the (unused) line "cdef int* p" then it works with Cython > 0.16. The issue is the pointer declaration; something like: > > def f(x): > cdef int p > p = eval(x) > return p*p > > works fine with Cython 0.16. > > Thanks, > > Nathan >
Oops, it seems to be a problem with locals() dict creation. Perhaps it should ignore variables that can't be converted to PyObject -- vitja. _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel