@@ -64,6 +64,10 @@ def to_tuple(t):
6464 "break" ,
6565 # Continue
6666 "continue" ,
67+ # for statements with naked tuples (see http://bugs.python.org/issue6704)
68+ "for a,b in c: pass" ,
69+ "[(a,b) for a,b in c]" ,
70+ "((a,b) for a,b in c)" ,
6771]
6872
6973# These are compiled through "single"
@@ -301,7 +305,7 @@ def main():
301305 print kind + "_results = ["
302306 for s in statements :
303307 print repr (to_tuple (compile (s , "?" , kind , 0x400 )))+ ","
304- print "]"
308+ print "]"
305309 print "main()"
306310 raise SystemExit
307311 test_main ()
@@ -330,6 +334,9 @@ def main():
330334('Module' , [('Pass' , (1 , 0 ))]),
331335('Module' , [('Break' , (1 , 0 ))]),
332336('Module' , [('Continue' , (1 , 0 ))]),
337+ ('Module' , [('For' , (1 , 0 ), ('Tuple' , (1 , 4 ), [('Name' , (1 , 4 ), 'a' , ('Store' ,)), ('Name' , (1 , 6 ), 'b' , ('Store' ,))], ('Store' ,)), ('Name' , (1 , 11 ), 'c' , ('Load' ,)), [('Pass' , (1 , 14 ))], [])]),
338+ ('Module' , [('Expr' , (1 , 0 ), ('ListComp' , (1 , 1 ), ('Tuple' , (1 , 2 ), [('Name' , (1 , 2 ), 'a' , ('Load' ,)), ('Name' , (1 , 4 ), 'b' , ('Load' ,))], ('Load' ,)), [('comprehension' , ('Tuple' , (1 , 11 ), [('Name' , (1 , 11 ), 'a' , ('Store' ,)), ('Name' , (1 , 13 ), 'b' , ('Store' ,))], ('Store' ,)), ('Name' , (1 , 18 ), 'c' , ('Load' ,)), [])]))]),
339+ ('Module' , [('Expr' , (1 , 0 ), ('GeneratorExp' , (1 , 1 ), ('Tuple' , (1 , 2 ), [('Name' , (1 , 2 ), 'a' , ('Load' ,)), ('Name' , (1 , 4 ), 'b' , ('Load' ,))], ('Load' ,)), [('comprehension' , ('Tuple' , (1 , 11 ), [('Name' , (1 , 11 ), 'a' , ('Store' ,)), ('Name' , (1 , 13 ), 'b' , ('Store' ,))], ('Store' ,)), ('Name' , (1 , 18 ), 'c' , ('Load' ,)), [])]))]),
333340]
334341single_results = [
335342('Interactive' , [('Expr' , (1 , 0 ), ('BinOp' , (1 , 0 ), ('Num' , (1 , 0 ), 1 ), ('Add' ,), ('Num' , (1 , 2 ), 2 )))]),
0 commit comments