[Python-checkins] python/dist/src/Grammar Grammar,1.54,1.55

nnorwitz@users.sourceforge.net nnorwitz at users.sourceforge.net
Fri Oct 21 08:24:05 CEST 2005


Update of /cvsroot/python/python/dist/src/Grammar
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8692/Grammar

Modified Files:
	Grammar 
Log Message:
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.


Index: Grammar
===================================================================
RCS file: /cvsroot/python/python/dist/src/Grammar/Grammar,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- Grammar	2 Aug 2005 00:46:38 -0000	1.54
+++ Grammar	21 Oct 2005 06:24:02 -0000	1.55
@@ -102,7 +102,7 @@
 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]



More information about the Python-checkins mailing list