[Cython] Possible bug when using cython -Wextra
Stefan Behnel
stefan_ml at behnel.de
Thu Feb 7 12:11:47 CET 2013
Samuele Kaplun, 07.02.2013 10:16:
> I am not sure if this is a bug or it is the intended behaviour, however,
> consider for example this snippet:
>
> [...]
> def test():
> cdef int i
> for i from 0 <= i < 10:
> print "foo"
> [...]
>
> If I save it into x.pyx and compile it with:
>
> $ cython -Wextra x.pyx
>
> I obtain the warning:
> [...]
> warning: x.pyx:2:13: Unused entry 'i'
> [...]
>
> IMHO, this is a false positive since the i variable is indeed used as a
> counter in the loop. I guess cython considers it unused due to the fact that
> it does not appear on the right hand side of an assignment nor it is further
> used as an argument in a function, isn’t it?
Yes, it actually is an unused variable in your code. There is no reference
to it, only assignments.
Stefan
More information about the cython-devel
mailing list