[Python-checkins] python/dist/src/Lib/compiler pycodegen.py,1.63,1.64
jhylton@users.sourceforge.net
jhylton@users.sourceforge.net
Tue, 31 Dec 2002 10:26:21 -0800
Update of /cvsroot/python/python/dist/src/Lib/compiler
In directory sc8-pr-cvs1:/tmp/cvs-serv8352
Modified Files:
pycodegen.py
Log Message:
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).
Index: pycodegen.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/compiler/pycodegen.py,v
retrieving revision 1.63
retrieving revision 1.64
diff -C2 -d -r1.63 -r1.64
*** pycodegen.py 31 Dec 2002 18:17:42 -0000 1.63
--- pycodegen.py 31 Dec 2002 18:26:17 -0000 1.64
***************
*** 609,613 ****
self.emit('GET_ITER')
self.nextBlock(start)
! self.emit('SET_LINENO', node.lineno)
self.emit('FOR_ITER', anchor)
self.nextBlock()
--- 609,613 ----
self.emit('GET_ITER')
self.nextBlock(start)
! self.set_lineno(node, force=True)
self.emit('FOR_ITER', anchor)
self.nextBlock()
***************
*** 1118,1130 ****
def visitDict(self, node):
! lineno = getattr(node, 'lineno', None)
! if lineno:
! self.emit('SET_LINENO', lineno)
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)
--- 1118,1124 ----
def visitDict(self, node):
! self.set_lineno(node)
self.emit('BUILD_MAP', 0)
for k, v in node.items:
self.emit('DUP_TOP')
self.visit(k)