diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2000-02-16 00:50:29 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2000-02-16 00:50:29 (GMT) |
commit | 2ce27b223bfa121351dd885acae0e54292926041 (patch) | |
tree | 90576b28e1ede4e1f4499d0018af845bc5846848 /Tools | |
parent | 65d4ea05d2b68df68305db82d4121246cfeb461e (diff) | |
download | cpython-2ce27b223bfa121351dd885acae0e54292926041.zip cpython-2ce27b223bfa121351dd885acae0e54292926041.tar.gz cpython-2ce27b223bfa121351dd885acae0e54292926041.tar.bz2 |
fix argcount generation for arg lists containing tuple unpacks
this is sort of a hack
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/compiler/compiler/pyassem.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Tools/compiler/compiler/pyassem.py b/Tools/compiler/compiler/pyassem.py index 2200dec..5ae7294 100644 --- a/Tools/compiler/compiler/pyassem.py +++ b/Tools/compiler/compiler/pyassem.py @@ -53,7 +53,7 @@ class PyAssembler: # XXX why is the default value for flags 3? self.insts = [] # used by makeCodeObject - self.argcount = len(args) + self._getArgCount(args) self.code = '' self.consts = [docstring] self.filename = filename @@ -67,6 +67,16 @@ class PyAssembler: self.last_addr = 0 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) @@ -231,7 +241,8 @@ class PyAssembler: return arg nameOps = ('STORE_NAME', 'IMPORT_NAME', 'IMPORT_FROM', - 'STORE_ATTR', 'LOAD_ATTR', 'LOAD_NAME', 'DELETE_NAME') + 'STORE_ATTR', 'LOAD_ATTR', 'LOAD_NAME', 'DELETE_NAME', + 'DELETE_ATTR') localOps = ('LOAD_FAST', 'STORE_FAST', 'DELETE_FAST') globalOps = ('LOAD_GLOBAL', 'STORE_GLOBAL', 'DELETE_GLOBAL') |