summaryrefslogtreecommitdiffstats
path: root/Lib/dis.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-01-16 18:52:24 (GMT)
committerGuido van Rossum <guido@python.org>1997-01-16 18:52:24 (GMT)
commitd0bc9cb869fad4b9712d8e212888300dcfa37ae3 (patch)
treebc4b67750251b615fd4ce5f6681666244f9545f3 /Lib/dis.py
parent5f4ce188984d2f09effaebb22ca980a72aacaad9 (diff)
downloadcpython-d0bc9cb869fad4b9712d8e212888300dcfa37ae3.zip
cpython-d0bc9cb869fad4b9712d8e212888300dcfa37ae3.tar.gz
cpython-d0bc9cb869fad4b9712d8e212888300dcfa37ae3.tar.bz2
Merge several mods:
- add opcodes BINARY_LSHIFT ... BINARY_OR - remove RESERVE_FAST - Skip M's suggestion for displaying which comparison operator is meant
Diffstat (limited to 'Lib/dis.py')
-rw-r--r--Lib/dis.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/Lib/dis.py b/Lib/dis.py
index dc5ce46..2324c8c 100644
--- a/Lib/dis.py
+++ b/Lib/dis.py
@@ -42,6 +42,8 @@ def disassemble(co, lasti):
print '(to ' + `i + oparg` + ')',
elif op in haslocal:
print '(' + co.co_varnames[oparg] + ')',
+ elif op in hascompare:
+ print '(' + cmp_op[oparg] + ')',
print
def findlabels(code):
@@ -65,11 +67,15 @@ def findlabels(code):
labels.append(label)
return labels
+cmp_op = ('<', '<=', '==', '!=', '>', '>=', 'in', 'not in', 'is',
+ 'is not', 'exception match', 'BAD')
+
hasconst = []
hasname = []
hasjrel = []
hasjabs = []
haslocal = []
+hascompare = []
opname = [''] * 256
for op in range(256): opname[op] = '<' + `op` + '>'
@@ -130,6 +136,11 @@ def_op('DELETE_SLICE+3', 53)
def_op('STORE_SUBSCR', 60)
def_op('DELETE_SUBSCR', 61)
+def_op('BINARY_LSHIFT', 62)
+def_op('BINARY_RSHIFT', 63)
+def_op('BINARY_AND', 64)
+def_op('BINARY_XOR', 65)
+def_op('BINARY_OR', 66)
def_op('PRINT_EXPR', 70)
def_op('PRINT_ITEM', 71)
@@ -161,6 +172,7 @@ name_op('UNPACK_VARARG', 99) # Minimal number of arguments
def_op('LOAD_CONST', 100) # Index in const list
hasconst.append(100)
name_op('LOAD_NAME', 101) # Index in name list
+hascompare.append(106)
def_op('BUILD_TUPLE', 102) # Number of tuple items
def_op('BUILD_LIST', 103) # Number of list items
def_op('BUILD_MAP', 104) # Always zero for now
@@ -183,8 +195,6 @@ jrel_op('SETUP_LOOP', 120) # Distance to target address
jrel_op('SETUP_EXCEPT', 121) # ""
jrel_op('SETUP_FINALLY', 122) # ""
-def_op('RESERVE_FAST', 123) # Number of local variables
-hasconst.append(123)
def_op('LOAD_FAST', 124) # Local variable number
haslocal.append(124)
def_op('STORE_FAST', 125) # Local variable number