[Python-checkins] cpython: construct fields in the right order (closes #15517)

benjamin.peterson python-checkins at python.org
Wed Aug 1 06:50:18 CEST 2012


http://hg.python.org/cpython/rev/cbfb915424fd
changeset:   78363:cbfb915424fd
parent:      78361:b213894e0859
user:        Benjamin Peterson <benjamin at python.org>
date:        Tue Jul 31 21:41:56 2012 -0700
summary:
  construct fields in the right order (closes #15517)

Patch from Taihyun Hwang.

files:
  Misc/ACKS      |   2 +-
  Parser/asdl.py |  10 ++--------
  2 files changed, 3 insertions(+), 9 deletions(-)


diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -476,6 +476,7 @@
 Jim Hugunin
 Greg Humphreys
 Eric Huss
+Taihyun Hwang
 Jeremy Hylton
 Gerhard Häring
 Fredrik Håård
@@ -1174,4 +1175,3 @@
 Kai Zhu
 Tarek Ziadé
 Peter Åstrand
-
diff --git a/Parser/asdl.py b/Parser/asdl.py
--- a/Parser/asdl.py
+++ b/Parser/asdl.py
@@ -156,15 +156,11 @@
         if id.value != "attributes":
             raise ASDLSyntaxError(id.lineno,
                                   msg="expected attributes, found %s" % id)
-        if attributes:
-            attributes.reverse()
         return Sum(sum, attributes)
 
     def p_product(self, info):
         " product ::= ( fields ) "
         _0, fields, _1 = info
-        # XXX can't I just construct things in the right order?
-        fields.reverse()
         return Product(fields)
 
     def p_sum_0(self, constructor):
@@ -188,8 +184,6 @@
     def p_constructor_1(self, info):
         " constructor ::= Id ( fields ) "
         id, _0, fields, _1 = info
-        # XXX can't I just construct things in the right order?
-        fields.reverse()
         return Constructor(id, fields)
 
     def p_fields_0(self, field):
@@ -197,8 +191,8 @@
         return [field[0]]
 
     def p_fields_1(self, info):
-        " fields ::= field , fields "
-        field, _, fields = info
+        " fields ::= fields , field "
+        fields, _, field = info
         return fields + [field]
 
     def p_field_0(self, type_):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list