From 4c6b0d5bec587770e0d83b550faae97fe251cc65 Mon Sep 17 00:00:00 2001 From: Neil Schemenauer Date: Wed, 16 Aug 2006 23:38:05 +0000 Subject: Fix a bug in the ``compiler`` package that caused invalid code to be generated for generator expressions. --- Lib/test/test_compiler.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Lib/test/test_compiler.py') diff --git a/Lib/test/test_compiler.py b/Lib/test/test_compiler.py index 1efb6a620f..81f2ea8925 100644 --- a/Lib/test/test_compiler.py +++ b/Lib/test/test_compiler.py @@ -116,6 +116,13 @@ class CompilerTest(unittest.TestCase): exec c in dct self.assertEquals(dct.get('result'), 3) + def testGenExp(self): + c = compiler.compile('list((i,j) for i in range(3) if i < 3' + ' for j in range(4) if j > 2)', + '', + 'eval') + self.assertEquals(eval(c), [(0, 3), (1, 3), (2, 3)]) + NOLINENO = (compiler.ast.Module, compiler.ast.Stmt, compiler.ast.Discard) -- cgit v1.2.1