[Python-checkins] CVS: /python/nondist/src/Compiler/compiler pyassem.py,1.6,1.7
Jeremy Hylton
jhylton@cnri.reston.va.us
Mon, 6 Mar 2000 13:53:18 -0500
Update of /projects/cvsroot//python/nondist/src/Compiler/compiler
In directory goon.cnri.reston.va.us:/home/jhylton/python/nondist/src/Compiler/compiler
Modified Files:
pyassem.py
Log Message:
revise arguments for addCode method on lnotab. take several numbers
that are internally converted to chars, rather than taking a string.
Index: pyassem.py
===================================================================
RCS file: /projects/cvsroot//python/nondist/src/Compiler/compiler/pyassem.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** pyassem.py 2000/02/21 22:46:00 1.6
--- pyassem.py 2000/03/06 18:53:14 1.7
***************
*** 144,158 ****
opname = t[0]
if len(t) == 1:
! lnotab.addCode(chr(self.opnum[opname]))
elif len(t) == 2:
- oparg = self._convertArg(opname, t[1])
if opname == 'SET_LINENO':
lnotab.nextLine(oparg)
try:
hi, lo = divmod(oparg, 256)
except TypeError:
raise TypeError, "untranslated arg: %s, %s" % (opname, oparg)
! lnotab.addCode(chr(self.opnum[opname]) + chr(lo) +
! chr(hi))
# why is a module a special case?
if self.flags == 0:
--- 144,160 ----
opname = t[0]
if len(t) == 1:
! lnotab.addCode(self.opnum[opname])
elif len(t) == 2:
if opname == 'SET_LINENO':
+ oparg = t[1]
lnotab.nextLine(oparg)
+ else:
+ oparg = self._convertArg(opname, t[1])
try:
hi, lo = divmod(oparg, 256)
except TypeError:
raise TypeError, "untranslated arg: %s, %s" % (opname, oparg)
! lnotab.addCode(self.opnum[opname], lo, hi)
!
# why is a module a special case?
if self.flags == 0:
***************
*** 325,331 ****
self.lnotab = []
! def addCode(self, code):
! self.code.append(code)
! self.codeOffset = self.codeOffset + len(code)
def nextLine(self, lineno):
--- 327,334 ----
self.lnotab = []
! def addCode(self, *args):
! for arg in args:
! self.code.append(chr(arg))
! self.codeOffset = self.codeOffset + len(args)
def nextLine(self, lineno):
***************
*** 452,458 ****
('IMPORT_', 1),
]
! # special cases
!
! #: UNPACK_TUPLE, UNPACK_LIST, BUILD_TUPLE,
# BUILD_LIST, CALL_FUNCTION, MAKE_FUNCTION, BUILD_SLICE
def UNPACK_TUPLE(self, count):
--- 455,461 ----
('IMPORT_', 1),
]
!
! # special cases:
! # UNPACK_TUPLE, UNPACK_LIST, BUILD_TUPLE,
# BUILD_LIST, CALL_FUNCTION, MAKE_FUNCTION, BUILD_SLICE
def UNPACK_TUPLE(self, count):