summaryrefslogtreecommitdiffstats
path: root/Lib/dis.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-09-12 17:39:36 (GMT)
committerGuido van Rossum <guido@python.org>1996-09-12 17:39:36 (GMT)
commit934a4cea8513c5acd7723558e0a4e905e6471e98 (patch)
tree491d538e6c0b4e2b9c86b53f99ae84ec15e04090 /Lib/dis.py
parentdc082eba02cd2845eb0c8a9fc27f79bf0847ddf0 (diff)
downloadcpython-934a4cea8513c5acd7723558e0a4e905e6471e98.zip
cpython-934a4cea8513c5acd7723558e0a4e905e6471e98.tar.gz
cpython-934a4cea8513c5acd7723558e0a4e905e6471e98.tar.bz2
Show names of locals in disco (Ka-Ping Yee)
Diffstat (limited to 'Lib/dis.py')
-rw-r--r--Lib/dis.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/dis.py b/Lib/dis.py
index 209d081..dc5ce46 100644
--- a/Lib/dis.py
+++ b/Lib/dis.py
@@ -40,6 +40,8 @@ def disassemble(co, lasti):
print '(' + co.co_names[oparg] + ')',
elif op in hasjrel:
print '(to ' + `i + oparg` + ')',
+ elif op in haslocal:
+ print '(' + co.co_varnames[oparg] + ')',
print
def findlabels(code):
@@ -67,6 +69,7 @@ hasconst = []
hasname = []
hasjrel = []
hasjabs = []
+haslocal = []
opname = [''] * 256
for op in range(256): opname[op] = '<' + `op` + '>'
@@ -183,8 +186,11 @@ 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
+haslocal.append(125)
def_op('DELETE_FAST', 126) # Local variable number
+haslocal.append(126)
def_op('SET_LINENO', 127) # Current line number
SET_LINENO = 127