Neal Becker wrote: > Neal Becker wrote: > >> This code: >> ------------------- >> import numpy as np >> cimport numpy as np >> >> np.import_array() >> >> cdef inline int x_ (int k, int n): >> cdef int center = (n-1)/2 >> return k-center >> >> def lagrange (float x, int n): >> >> cdef np.ndarray[np.float64_t, ndim=1] ret # = np.empty (n, >> dtype=float) cdef int j, k >> cdef float prod, top, bot >> >> for j in range (n): >> prod = 1 >> for k in xrange (0, n): >> if (k != j): >> top = x - x_(k, n) >> bot = x_(j, n) - x_(k, n) >> prod *= top/bot >> ret[j] = prod >> return ret >> -------------- >> >> gives: >> >> _lagrange_coef.cpp: In function ‘PyObject* >> __pyx_pf_14_lagrange_coef_lagrange(PyObject*, PyObject*, PyObject*)’: >> _lagrange_coef.cpp:941: error: ‘__Pyx_SafeReleaseBuffer’ was not declared >> in this scope >> _lagrange_coef.cpp:947: error: ‘__Pyx_SafeReleaseBuffer’ was not declared >> in this scope >> >> No error with the comment (np.empty) removed. Bug or user error? >> > > Any ideas on this?
Thanks for the report, this is now fixed (reported and closed as #444). (Of course, the only effect this can have is that you'll get a segfault at runtime instead... :-) but Cython should never create unexpected noncompileable code and a segfault is better in this case.) -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
