summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_compiler.py
diff options
context:
space:
mode:
authorNeil Schemenauer <nascheme@enme.ucalgary.ca>2006-08-16 23:38:05 (GMT)
committerNeil Schemenauer <nascheme@enme.ucalgary.ca>2006-08-16 23:38:05 (GMT)
commit4c6b0d5bec587770e0d83b550faae97fe251cc65 (patch)
tree1b472e824d748456dc4823ca047d67fd807c8d2f /Lib/test/test_compiler.py
parent7ae354846fff616746eeba6d27ccd5c175591cae (diff)
downloadcpython-4c6b0d5bec587770e0d83b550faae97fe251cc65.zip
cpython-4c6b0d5bec587770e0d83b550faae97fe251cc65.tar.gz
cpython-4c6b0d5bec587770e0d83b550faae97fe251cc65.tar.bz2
Fix a bug in the ``compiler`` package that caused invalid code to be
generated for generator expressions.
Diffstat (limited to 'Lib/test/test_compiler.py')
-rw-r--r--Lib/test/test_compiler.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_compiler.py b/Lib/test/test_compiler.py
index 1efb6a6..81f2ea8 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)',
+ '<string>',
+ 'eval')
+ self.assertEquals(eval(c), [(0, 3), (1, 3), (2, 3)])
+
NOLINENO = (compiler.ast.Module, compiler.ast.Stmt, compiler.ast.Discard)