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

Skip to content

Commit b631b8e

Browse files
committed
fix list.append problems
1 parent e4d6293 commit b631b8e

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

Lib/compiler/transformer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ def comparison(self, nodelist):
569569
type = _cmp_types[n[0]]
570570

571571
lineno = nl[1][2]
572-
results.append(type, self.com_node(nodelist[i]))
572+
results.append((type, self.com_node(nodelist[i])))
573573

574574
# we need a special "compare" node so that we can distinguish
575575
# 3 < x < 5 from (3 < x) < 5
@@ -836,7 +836,7 @@ def com_try_except(self, nodelist):
836836
expr2 = None
837837
else:
838838
expr1 = expr2 = None
839-
clauses.append(expr1, expr2, self.com_node(nodelist[i+2]))
839+
clauses.append((expr1, expr2, self.com_node(nodelist[i+2])))
840840

841841
if node[0] == token.NAME:
842842
elseNode = self.com_node(nodelist[i+2])
@@ -958,7 +958,7 @@ def com_dictmaker(self, nodelist):
958958
# dictmaker: test ':' test (',' test ':' value)* [',']
959959
items = [ ]
960960
for i in range(1, len(nodelist), 4):
961-
items.append(self.com_node(nodelist[i]), self.com_node(nodelist[i+2]))
961+
items.append((self.com_node(nodelist[i]), self.com_node(nodelist[i+2])))
962962
return Node('dict', items)
963963

964964
def com_apply_trailer(self, primaryNode, nodelist):

Tools/compiler/compiler/transformer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ def comparison(self, nodelist):
569569
type = _cmp_types[n[0]]
570570

571571
lineno = nl[1][2]
572-
results.append(type, self.com_node(nodelist[i]))
572+
results.append((type, self.com_node(nodelist[i])))
573573

574574
# we need a special "compare" node so that we can distinguish
575575
# 3 < x < 5 from (3 < x) < 5
@@ -836,7 +836,7 @@ def com_try_except(self, nodelist):
836836
expr2 = None
837837
else:
838838
expr1 = expr2 = None
839-
clauses.append(expr1, expr2, self.com_node(nodelist[i+2]))
839+
clauses.append((expr1, expr2, self.com_node(nodelist[i+2])))
840840

841841
if node[0] == token.NAME:
842842
elseNode = self.com_node(nodelist[i+2])
@@ -958,7 +958,7 @@ def com_dictmaker(self, nodelist):
958958
# dictmaker: test ':' test (',' test ':' value)* [',']
959959
items = [ ]
960960
for i in range(1, len(nodelist), 4):
961-
items.append(self.com_node(nodelist[i]), self.com_node(nodelist[i+2]))
961+
items.append((self.com_node(nodelist[i]), self.com_node(nodelist[i+2])))
962962
return Node('dict', items)
963963

964964
def com_apply_trailer(self, primaryNode, nodelist):

0 commit comments

Comments
 (0)