diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2002-12-31 18:26:17 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2002-12-31 18:26:17 (GMT) |
commit | 18565411429053a68ee318fc9e59370e8bd7b7b8 (patch) | |
tree | eb03f285139a8cb3c1b27b9ae1f7563ac922ac27 | |
parent | cf94ee817c71a8e18aa637893c3a5910e20290d9 (diff) | |
download | cpython-18565411429053a68ee318fc9e59370e8bd7b7b8.zip cpython-18565411429053a68ee318fc9e59370e8bd7b7b8.tar.gz cpython-18565411429053a68ee318fc9e59370e8bd7b7b8.tar.bz2 |
Replace all but one explicit emit('SET_LINENO') with call to set_lineno().
Remove broken code in visitDict(). I assume the code was trying to
add set lineno events for each line of a dict constructor, but I think
it was using the wrong object (node instead of k or v).
-rw-r--r-- | Lib/compiler/pycodegen.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/Lib/compiler/pycodegen.py b/Lib/compiler/pycodegen.py index a3518d2..a6face0 100644 --- a/Lib/compiler/pycodegen.py +++ b/Lib/compiler/pycodegen.py @@ -608,7 +608,7 @@ class CodeGenerator: self.visit(node.list) self.emit('GET_ITER') self.nextBlock(start) - self.emit('SET_LINENO', node.lineno) + self.set_lineno(node, force=True) self.emit('FOR_ITER', anchor) self.nextBlock() self.visit(node.assign) @@ -1117,15 +1117,9 @@ class CodeGenerator: self.emit('BUILD_SLICE', len(node.nodes)) def visitDict(self, node): - lineno = getattr(node, 'lineno', None) - if lineno: - self.emit('SET_LINENO', lineno) + self.set_lineno(node) self.emit('BUILD_MAP', 0) for k, v in node.items: - lineno2 = getattr(node, 'lineno', None) - if lineno2 is not None and lineno != lineno2: - self.emit('SET_LINENO', lineno2) - lineno = lineno2 self.emit('DUP_TOP') self.visit(k) self.visit(v) |