4 @cython.test_assert_path_exists('//ComprehensionNode')
5 @cython.test_fail_if_path_exists('//SimpleCallNode')
6 def list_genexpr_iterable_lookup():
9 >>> [ x*2 for x in x if x % 2 == 0 ] # leaks in Py2 but finds the right 'x'
12 >>> list_genexpr_iterable_lookup()
16 result = list( x*2 for x in x if x % 2 == 0 )
17 assert x == (0,1,2,3,4,5)
20 @cython.test_assert_path_exists('//ComprehensionNode')
21 @cython.test_fail_if_path_exists('//SingleAssignmentNode//SimpleCallNode')
22 def genexpr_iterable_in_closure():
24 >>> genexpr_iterable_in_closure()
30 result = list( x*2 for x in x if x % 2 == 0 )
31 assert x == 'abc' # don't leak in Py3 code
32 assert f() == 'abc' # don't leak in Py3 code