Cython doesn't like numpy arrays in closure?
%%cython
import numpy as np
cimport numpy as np
def f(np.ndarray[double, ndim=1] a):
def g (double b):
return a+b
return g(1)
Using the stable version 0.24, I get:
Error compiling Cython file:
------------------------------------------------------------
...
import numpy as np
cimport numpy as np
def f(np.ndarray[double, ndim=1] a):
^
------------------------------------------------------------
cython_magic.pyx:4:6: Buffer types only allowed as function local variables
If I get rid of the definition g, it compiles / works fine.
source
share