Add lineno attributes to Discard nodes

This commit is contained in:
Jeremy Hylton 2001-04-11 16:22:26 +00:00
parent 5af105eec9
commit 4c1f42733c
2 changed files with 6 additions and 2 deletions

View File

@ -272,7 +272,9 @@ def expr_stmt(self, nodelist):
# augassign testlist | testlist ('=' testlist)*
exprNode = self.com_node(nodelist[-1])
if len(nodelist) == 1:
return Discard(exprNode)
n = Discard(exprNode)
n.lineno = exprNode.lineno
return n
if nodelist[1][0] == token.EQUAL:
nodes = []
for i in range(0, len(nodelist) - 2, 2):

View File

@ -272,7 +272,9 @@ def expr_stmt(self, nodelist):
# augassign testlist | testlist ('=' testlist)*
exprNode = self.com_node(nodelist[-1])
if len(nodelist) == 1:
return Discard(exprNode)
n = Discard(exprNode)
n.lineno = exprNode.lineno
return n
if nodelist[1][0] == token.EQUAL:
nodes = []
for i in range(0, len(nodelist) - 2, 2):