[Cython] Cython generates invalid C code for some generator expressions in cdef functions
Stefan Behnel
stefan_ml at behnel.de
Thu May 21 22:02:56 CEST 2015
Michael Enßlin schrieb am 08.05.2015 um 14:37:
> Take the following example:
>
>
> $ cat t2.pyx
> cdef void read_callback():
> foo = b"asdf"
> bar = (c for c in foo)
>
>
>
> $ cython t2.pyx
>
>
>
> $ gcc -I/usr/include/python3.4m t2.c
> t2.c: In function ‘__pyx_f_2t2_read_callback’:
> t2.c:778:12: error: ‘None’ undeclared (first use in this function)
> return None;
> ^
> t2.c:778:12: note: each undeclared identifier is reported only once for
> each function it appears in
> t2.c:778:5: warning: ‘return’ with a value, in function returning void
> return None;
> ^
>
>
> Note that the error does not occur for
>
> bar = (c for c in b"asdf")
>
> or
>
> bar = [c for c in b"asdf"]
Thanks for the report. This should fix it:
https://github.com/cython/cython/commit/f8b952c16dc569e50642d426e328d2d0fe0f53aa
Stefan
More information about the cython-devel
mailing list