On 9 February 2013 07:03, David Hirschfeld <dave.hirschf...@gmail.com> wrote: > Reposting because I think my original got blocked because of > attachments. Apologies if this appears twice. > > I want to allow arbitrary C/F contiguous arrays as input to a cdef > class so I can dispatch to a different calculation method in each > case, avoiding a potentially costly copy. > Unfortunately, it appears that cython is generating incorrect code. > The following minimal example reproduces the problem: > > cimport cython > > cdef class TestContig: > > cdef cython.bint contig > > def __init__(self, double[:,:] y): > if y.is_c_contig(): > self.contig = 1 > elif y.is_f_contig(): > self.contig = 1 > else: > self.contig = 0 > > property contig: > def __get__(self): > return self.contig > > # > > > C:\temp> python setup.py build_ext --inplace > running build_ext > building 'example' extension > C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\cl.exe /c > /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\dev\bin\Python27\include > -IC:\dev\bin\Python27\PC /Tpexample.cpp > /Fobuild\temp.win32-2.7\Release\example.obj > example.cpp > example.cpp(1277) : error C3861: '__pyx_memviewslice_is_f_contig2': > identifier not found > error: command '"C:\Program Files (x86)\Microsoft Visual Studio > 11.0\VC\BIN\cl.exe"' failed with exit status 2 > C:\temp> > > > I'm on Windows7 with 32bit Python2.7 and I tested that compilation > fails with both VS2012 & MinGW32 4.6.1. > > NB: If you only check for f-contiguity (or c-contiguity) in the method it > compiles fine, it appears that the bug only appears when you test for > both f and c contiguity in the same method. > > > Thanks, > Dave > _______________________________________________ > cython-devel mailing list > cython-devel@python.org > http://mail.python.org/mailman/listinfo/cython-devel
Thanks, Cython seems to think (for some reason) that the second function is the same as the first and omits the definition. _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel