generator expressions do not work in closures
|Reported by:||scoder||Owned by:||scoder|
# cython: language_level=3 def list_comp_in_closure(): """ >>> list_comp_in_closure() [0, 4, 8] """ x = 'abc' def f(): return x result = [x*2 for x in range(5) if x % 2 == 0] assert x == 'abc' # don't leak in Py3 code assert f() == 'abc' # don't leak in Py3 code return result
generates invalid C code: the loop variable is defined in the closure struct but has a different name inside of the function code.
Change History (3)
Note: See TracTickets for help on using tickets.