[Python-checkins] CVS: python/dist/src/Lib dis.py,1.30,1.31
Jeremy Hylton
jhylton@users.sourceforge.net
Thu, 25 Jan 2001 12:08:49 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv24525/Lib
Modified Files:
dis.py
Log Message:
PEP 227 implementation
Track changes to new opcodes. Add hasfree list that applies to all
ops that use the closure.
Index: dis.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/dis.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -r1.30 -r1.31
*** dis.py 2001/01/20 19:54:20 1.30
--- dis.py 2001/01/25 20:08:47 1.31
***************
*** 7,11 ****
__all__ = ["dis","disassemble","distb","disco","opname","cmp_op",
"hasconst","hasname","hasjrel","hasjabs","haslocal",
! "hascompare"]
def dis(x=None):
--- 7,11 ----
__all__ = ["dis","disassemble","distb","disco","opname","cmp_op",
"hasconst","hasname","hasjrel","hasjabs","haslocal",
! "hascompare", "hasfree"]
def dis(x=None):
***************
*** 61,64 ****
--- 61,65 ----
i = 0
extended_arg = 0
+ free = None
while i < n:
c = code[i]
***************
*** 89,92 ****
--- 90,97 ----
elif op in hascompare:
print '(' + cmp_op[oparg] + ')',
+ elif op in hasfree:
+ if free is None:
+ free = co.co_cellvars + co.co_freevars
+ print '(' + free[oparg] + ')',
print
***************
*** 128,131 ****
--- 133,137 ----
haslocal = []
hascompare = []
+ hasfree = []
opname = [''] * 256
***************
*** 272,275 ****
--- 278,289 ----
def_op('MAKE_FUNCTION', 132) # Number of args with default values
def_op('BUILD_SLICE', 133) # Number of items
+
+ def_op('MAKE_CLOSURE', 134)
+ def_op('LOAD_CLOSURE', 135)
+ hasfree.append(135)
+ def_op('LOAD_DEREF', 136)
+ hasfree.append(136)
+ def_op('STORE_DEREF', 137)
+ hasfree.append(137)
def_op('CALL_FUNCTION_VAR', 140) # #args + (#kwargs << 8)