summaryrefslogtreecommitdiffstats
path: root/Tools/compiler
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-08-29 20:57:43 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-08-29 20:57:43 (GMT)
commit1936745668f44dd121b50fef31a70efc07cc4ebf (patch)
tree378ba3f0b48654c7ac6f7e8514cd563d8ed51e93 /Tools/compiler
parent7845cf8d37f3b1d6cb29cdc9998d1c8b607e251e (diff)
downloadcpython-1936745668f44dd121b50fef31a70efc07cc4ebf.zip
cpython-1936745668f44dd121b50fef31a70efc07cc4ebf.tar.gz
cpython-1936745668f44dd121b50fef31a70efc07cc4ebf.tar.bz2
Generate SET_LINENO for list and tuple literals when the open paren
starts a new line. Also fix undetected typo in visitDict() -- uncovered by recent change to add lineno attrs to atoms.
Diffstat (limited to 'Tools/compiler')
-rw-r--r--Tools/compiler/compiler/pycodegen.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Tools/compiler/compiler/pycodegen.py b/Tools/compiler/compiler/pycodegen.py
index b0bddb7..07c82f7 100644
--- a/Tools/compiler/compiler/pycodegen.py
+++ b/Tools/compiler/compiler/pycodegen.py
@@ -953,11 +953,13 @@ class CodeGenerator:
self.emit('LOAD_CONST', Ellipsis)
def visitTuple(self, node):
+ self.set_lineno(node)
for elt in node.nodes:
self.visit(elt)
self.emit('BUILD_TUPLE', len(node.nodes))
def visitList(self, node):
+ self.set_lineno(node)
for elt in node.nodes:
self.visit(elt)
self.emit('BUILD_LIST', len(node.nodes))
@@ -970,7 +972,7 @@ class CodeGenerator:
def visitDict(self, node):
lineno = getattr(node, 'lineno', None)
if lineno:
- set.emit('SET_LINENO', lineno)
+ self.emit('SET_LINENO', lineno)
self.emit('BUILD_MAP', 0)
for k, v in node.items:
lineno2 = getattr(node, 'lineno', None)