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

    



_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel

Reply via email to