]> granicus.if.org Git - python/commitdiff
Fix SF bug #1466641: multiple adjacent 'if's in listcomps and genexps, as in
authorThomas Wouters <thomas@python.org>
Wed, 12 Apr 2006 00:06:34 +0000 (00:06 +0000)
committerThomas Wouters <thomas@python.org>
Wed, 12 Apr 2006 00:06:34 +0000 (00:06 +0000)
[x for x in it if x if x], were broken for no good reason by the PEP 308
patch.

Grammar/Grammar

index 9f66df648d58d130fdf959e4b03e553125bb52e9..6c497dc9177fcaf61b0f159441156915ee462ab4 100644 (file)
@@ -131,11 +131,11 @@ argument: test [gen_for] | test '=' test  # Really [keyword '='] test
 
 list_iter: list_for | list_if
 list_for: 'for' exprlist 'in' testlist_safe [list_iter]
-list_if: 'if' test [list_iter]
+list_if: 'if' old_test [list_iter]
 
 gen_iter: gen_for | gen_if
 gen_for: 'for' exprlist 'in' or_test [gen_iter]
-gen_if: 'if' test [gen_iter]
+gen_if: 'if' old_test [gen_iter]
 
 testlist1: test (',' test)*