Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 481ae50

Browse files
committed
construct fields in the right order (closes python#15517)
Patch from Taihyun Hwang.
1 parent 0efcf99 commit 481ae50

2 files changed

Lines changed: 3 additions & 9 deletions

File tree

Misc/ACKS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ Michael Hudson
476476
Jim Hugunin
477477
Greg Humphreys
478478
Eric Huss
479+
Taihyun Hwang
479480
Jeremy Hylton
480481
Gerhard Häring
481482
Fredrik Håård
@@ -1174,4 +1175,3 @@ Uwe Zessin
11741175
Kai Zhu
11751176
Tarek Ziadé
11761177
Peter Åstrand
1177-

Parser/asdl.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,11 @@ def p_type_2(self, info):
156156
if id.value != "attributes":
157157
raise ASDLSyntaxError(id.lineno,
158158
msg="expected attributes, found %s" % id)
159-
if attributes:
160-
attributes.reverse()
161159
return Sum(sum, attributes)
162160

163161
def p_product(self, info):
164162
" product ::= ( fields ) "
165163
_0, fields, _1 = info
166-
# XXX can't I just construct things in the right order?
167-
fields.reverse()
168164
return Product(fields)
169165

170166
def p_sum_0(self, constructor):
@@ -188,17 +184,15 @@ def p_constructor_0(self, id):
188184
def p_constructor_1(self, info):
189185
" constructor ::= Id ( fields ) "
190186
id, _0, fields, _1 = info
191-
# XXX can't I just construct things in the right order?
192-
fields.reverse()
193187
return Constructor(id, fields)
194188

195189
def p_fields_0(self, field):
196190
" fields ::= field "
197191
return [field[0]]
198192

199193
def p_fields_1(self, info):
200-
" fields ::= field , fields "
201-
field, _, fields = info
194+
" fields ::= fields , field "
195+
fields, _, field = info
202196
return fields + [field]
203197

204198
def p_field_0(self, type_):

0 commit comments

Comments
 (0)