Matthew Brett wrote: > Hi, > > We've run into a somewhat confusing error. When trying to compile > this tiny thing: > > import numpy as np > cimport numpy as cnp > > def func(): > cdef cnp.ndarray[cnp.float64_t, ndim=2] arr1 > a = np.pi > > we get this: > > gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall > -Wstrict-prototypes > -I/Users/mb312/usr/local/lib/python2.6/site-packages/numpy/core/include > -I/Users/mb312/usr/local/include/python2.6 -c eg_thing.c -o > build/temp.macosx-10.6-i386-2.6/eg_thing.o > eg_thing.c: In function ‘__pyx_pf_8eg_thing_func’: > eg_thing.c:749: error: ‘__pyx_bstruct_arr1’ undeclared (first use in > this function) > eg_thing.c:749: error: (Each undeclared identifier is reported only once > eg_thing.c:749: error: for each function it appears in.) > > It's an odd error because this: > > def func(): > cdef cnp.ndarray[cnp.float64_t, ndim=2] arr1 > a = 2 > > compiles fine, as does this: > > def func(): > cdef cnp.ndarray arr1 > a = np.pi > > and this: > > def func(): > cdef cnp.ndarray[cnp.float64_t, ndim=2] arr1 > arr1 = np.zeros((1,1)) > > so I suppose it may be an interaction of the buffer types syntax with > the uninitialized array and numpy. We using Cython 12.1... > Yep, that's exactly what it is. It's a bug, feel free to file it if it isn't already.
I don't consider it very critical, as having unused variables around is hardly a requirement, but I agree it should be fixed. Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
