Stefan Behnel, 01.05.2013 09:45: > Lisandro Dalcin, 01.05.2013 09:14: >> See the example below, the last hunk fails with Cython 0.19. It seems >> Cython is confusing attribute access with constness. >> >> >> CYTHON=cython >> >> echo 'cdef import from *:' > defs.pxd >> echo ' enum:SIZE' >> defs.pxd >> >> echo 'from defs cimport *' > code1.pyx >> echo 'cdef char buf[SIZE]' >> code1.pyx >> $CYTHON code1.pyx >> >> echo 'cimport defs' > code2.pyx >> echo 'cdef char buf[defs.SIZE]' >> code2.pyx >> $CYTHON code2.pyx > > With the above setup, I get Cython compile errors in 0.19: > > Error compiling Cython file: > ------------------------------------------------------------ > ... > cimport defs > cdef char buf[defs.SIZE] > ^ > ------------------------------------------------------------ > code2.pyx:2:18: Not allowed in a constant expression > > Interesting enough, this happens during declaration analysis, not during > type analysis. Looks like that's needed because the array size is part of > the declaration. > > ISTM that the implementation of analyse_const_expression() is wrong. It > doesn't care about the result of analyse_types().
Yep, an oversight of my analyse_types() refactoring and cleanup. https://github.com/scoder/cython/commit/db1f0ad5a5ac45d2a1da45211f9d344b4d83cab8 I'll give it a run through Jenkins before pushing it upstream. Stefan _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel