I've encountered a problem with Cython 0.12.1 in which incorrect code
annotations show up when HTML is generated with the "--annotate" option.
I believe this is the same issue described here:
http://trac.cython.org/cython_trac/ticket/292
I've come up with an even simpler test case that triggers the behavior.
The test.pyx file is attached. What happens is that the generated HTML
for line 187 ("cdef int y = 6"), once expanded, reads as follows:
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject
*__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags);
__pyx_v_4test_y = 6;
It appears to be pulling in code from both test.pyx line 187 *and*
numpy.pxd line 187, even though the annotation should only be for
test.pyx. The generated code in test.c is simply "__pyx_v_4test_y = 6;"
without the extraneous numpy.pxd __getbuffer__ code.
This problem makes Cython HTML annotation with NumPy code very difficult
to use, because it's not immediately apparent from any given yellow line
whether it's actually triggering the generation of NumPy code or whether
it's merely including it in the annotation erroneously.
If this sort of thing is more appropriate on the other mailing list,
please let me know.
Dan
import numpy as np
cimport numpy as np
# Scroll down for more..
cdef int x = 5
cdef int y = 6 # The generated HTML annotation for this line is incorrect!
cdef int z = 7
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev