mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
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.
This commit is contained in:
parent
c0d5faa9b4
commit
37c0844b35
3 changed files with 30 additions and 10 deletions
|
@ -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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue