[Python-checkins] python/dist/src/Include Python-ast.h,,

bcannon at users.sourceforge.net bcannon at users.sourceforge.net
Wed Apr 13 21:45:10 CEST 2005

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

Modified Files:
      Tag: ast-branch
Log Message:
Add support for genexps.  Required changing the name to GeneratorExp for
consistency in Parser/Python.asdl (and subsequent changes to other files
because of this), regenerating the Python-ast.(h|c) files, and
then the necessary changes to Python/ast.c and Python/newcompile.c .

Also includes a tweak to asdl_seq_new() to not call malloc() with a -1 if an
empty asdl_seq struct is needed.  Lastly, it silences output of the results of
functions while they are doing internal calls; allows doctest to work properly.

Not thoroughly tested since test_grammar segfaults before it reaches genexps.
But hand-testing seems to show everything works.

Closes patch #1167628.  Thanks Nick Coghlan.

Index: Python-ast.h
RCS file: /cvsroot/python/python/dist/src/Include/Attic/Python-ast.h,v
retrieving revision
retrieving revision
diff -u -d -r1.1.2.11 -r1.1.2.12
--- Python-ast.h	2 Apr 2005 18:50:05 -0000
+++ Python-ast.h	13 Apr 2005 19:44:37 -0000
@@ -1,4 +1,4 @@
-/* File automatically generated by ../Parser/asdl_c.py */
+/* File automatically generated by ./Parser/asdl_c.py */
 #include "asdl.h"
@@ -178,7 +178,7 @@
 struct _expr {
         enum { BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4,
-               Dict_kind=5, ListComp_kind=6, GeneratorComp_kind=7,
+               Dict_kind=5, ListComp_kind=6, GeneratorExp_kind=7,
                Compare_kind=8, Call_kind=9, Repr_kind=10, Num_kind=11,
                Str_kind=12, Attribute_kind=13, Subscript_kind=14, Name_kind=15,
                List_kind=16, Tuple_kind=17 } kind;
@@ -217,7 +217,7 @@
                 struct {
                         expr_ty elt;
                         asdl_seq *generators;
-                } GeneratorComp;
+                } GeneratorExp;
                 struct {
                         expr_ty left;
@@ -362,7 +362,7 @@
 expr_ty Lambda(arguments_ty args, expr_ty body);
 expr_ty Dict(asdl_seq * keys, asdl_seq * values);
 expr_ty ListComp(expr_ty elt, asdl_seq * generators);
-expr_ty GeneratorComp(expr_ty elt, asdl_seq * generators);
+expr_ty GeneratorExp(expr_ty elt, asdl_seq * generators);
 expr_ty Compare(expr_ty left, asdl_seq * ops, asdl_seq * comparators);
 expr_ty Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty
              starargs, expr_ty kwargs);

More information about the Python-checkins mailing list