[Python-checkins] CVS: python/dist/src/Include graminit.h,2.17,2.18

Guido van Rossum gvanrossum@users.sourceforge.net
Mon, 15 Oct 2001 08:44:07 -0700


Update of /cvsroot/python/python/dist/src/Include
In directory usw-pr-cvs1:/tmp/cvs-serv24320/Include

Modified Files:
	graminit.h 
Log Message:
Very subtle syntax change: in a list comprehension, the testlist in
"for <var> in <testlist> may no longer be a single test followed by
a comma.  This solves SF bug #431886.  Note that if the testlist
contains more than one test, a trailing comma is still allowed, for
maximum backward compatibility; but this example is not:

    [(x, y) for x in range(10), for y in range(10)]
                              ^

The fix involved creating a new nonterminal 'testlist_safe' whose
definition doesn't allow the trailing comma if there's only one test:

    testlist_safe: test [(',' test)+ [',']]



Index: graminit.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/graminit.h,v
retrieving revision 2.17
retrieving revision 2.18
diff -C2 -d -r2.17 -r2.18
*** graminit.h	2001/06/18 22:08:13	2.17
--- graminit.h	2001/10/15 15:44:04	2.18
***************
*** 57,65 ****
  #define exprlist 312
  #define testlist 313
! #define dictmaker 314
! #define classdef 315
! #define arglist 316
! #define argument 317
! #define list_iter 318
! #define list_for 319
! #define list_if 320
--- 57,66 ----
  #define exprlist 312
  #define testlist 313
! #define testlist_safe 314
! #define dictmaker 315
! #define classdef 316
! #define arglist 317
! #define argument 318
! #define list_iter 319
! #define list_for 320
! #define list_if 321