[Python-checkins] CVS: /python/nondist/src/Compiler pyassem.py,1.2,1.3
Jeremy Hylton
jhylton@cnri.reston.va.us
Tue, 15 Feb 2000 19:50:31 -0500
Update of /projects/cvsroot//python/nondist/src/Compiler
In directory goon.cnri.reston.va.us:/home/jhylton/python/nondist/src/Compiler
Modified Files:
pyassem.py
Log Message:
fix argcount generation for arg lists containing tuple unpacks
this is sort of a hack
Index: pyassem.py
===================================================================
RCS file: /projects/cvsroot//python/nondist/src/Compiler/pyassem.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** pyassem.py 2000/02/15 21:59:50 1.2
--- pyassem.py 2000/02/16 00:50:29 1.3
***************
*** 54,58 ****
self.insts = []
# used by makeCodeObject
! self.argcount = len(args)
self.code = ''
self.consts = [docstring]
--- 54,58 ----
self.insts = []
# used by makeCodeObject
! self._getArgCount(args)
self.code = ''
self.consts = [docstring]
***************
*** 68,71 ****
--- 68,81 ----
self.lnotab = ''
+ def _getArgCount(self, args):
+ if args and args[0][0] == '.':
+ for i in range(len(args)):
+ if args[i][0] == '.':
+ num = i
+ self.argcount = num + 1
+ else:
+ self.argcount = len(args)
+
+
def __repr__(self):
return "<bytecode: %d instrs>" % len(self.insts)
***************
*** 232,236 ****
nameOps = ('STORE_NAME', 'IMPORT_NAME', 'IMPORT_FROM',
! 'STORE_ATTR', 'LOAD_ATTR', 'LOAD_NAME', 'DELETE_NAME')
localOps = ('LOAD_FAST', 'STORE_FAST', 'DELETE_FAST')
globalOps = ('LOAD_GLOBAL', 'STORE_GLOBAL', 'DELETE_GLOBAL')
--- 242,247 ----
nameOps = ('STORE_NAME', 'IMPORT_NAME', 'IMPORT_FROM',
! 'STORE_ATTR', 'LOAD_ATTR', 'LOAD_NAME', 'DELETE_NAME',
! 'DELETE_ATTR')
localOps = ('LOAD_FAST', 'STORE_FAST', 'DELETE_FAST')
globalOps = ('LOAD_GLOBAL', 'STORE_GLOBAL', 'DELETE_GLOBAL')