summaryrefslogtreecommitdiffstats
path: root/Grammar
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2005-10-21 06:24:02 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2005-10-21 06:24:02 (GMT)
commit37c0844b35b9a4d68f7ddf3a8b38d3e013f17d78 (patch)
tree345859c3266fdc71bf64f076ed16507c2d3051de /Grammar
parentc0d5faa9b4a763befbeab0159d2241a9ddf85b56 (diff)
downloadcpython-37c0844b35b9a4d68f7ddf3a8b38d3e013f17d78.zip
cpython-37c0844b35b9a4d68f7ddf3a8b38d3e013f17d78.tar.gz
cpython-37c0844b35b9a4d68f7ddf3a8b38d3e013f17d78.tar.bz2
Fix SF bug #1167751, Argument genexp corner case
Incorrect code was generated for: foo(a = i for i in range(10)) This should have generated a SyntaxError. Fix the Grammar so it raises a SyntaxError and test it. I'm uncertain whether this should be backported. It makes something that was Syntactically valid invalid. However, the code would either be completely broken or do the wrong thing.
Diffstat (limited to 'Grammar')
-rw-r--r--Grammar/Grammar2
1 files changed, 1 insertions, 1 deletions
diff --git a/Grammar/Grammar b/Grammar/Grammar
index 01e4afd..d8106e9 100644
--- a/Grammar/Grammar
+++ b/Grammar/Grammar
@@ -102,7 +102,7 @@ dictmaker: test ':' test (',' test ':' test)* [',']
classdef: 'class' NAME ['(' [testlist] ')'] ':' suite
arglist: (argument ',')* (argument [',']| '*' test [',' '**' test] | '**' test)
-argument: [test '='] test [gen_for] # Really [keyword '='] test
+argument: test [gen_for] | test '=' test ['(' gen_for ')'] # Really [keyword '='] test
list_iter: list_for | list_if
list_for: 'for' exprlist 'in' testlist_safe [list_iter]