Module dis
[hide private]
[frames] | no frames]

Module dis

Disassembler of Python byte code into mnemonics.

Functions [hide private]
 
dis(x=None)
Disassemble classes, methods, functions, or code.
 
distb(tb=None)
Disassemble a traceback (default: last traceback).
 
disassemble(co, lasti=-1)
Disassemble a code object.
 
disassemble_string(code, lasti=-1, varnames=None, names=None, constants=None)
 
disco(co, lasti=-1)
Disassemble a code object.
 
findlabels(code)
Detect all offsets in a byte code which are jump targets.
 
findlinestarts(code)
Find the offsets in a byte code which are start of lines in the source.
 
_test()
Simple test program to disassemble a file.
Variables [hide private]
  hasjrel = [93, 110, 111, 112, 120, 121, 122]
  hasconst = [100]
  EXTENDED_ARG = 143
  hasfree = [135, 136, 137]
  hascompare = [106]
  hasjabs = [113, 119]
  opmap = {'BINARY_ADD': 23, 'BINARY_AND': 64, 'BINARY_DIVIDE': ...
  haslocal = [124, 125, 126]
  opname = ['STOP_CODE', 'POP_TOP', 'ROT_TWO', 'ROT_THREE', 'DUP...
  cmp_op = ('<', '<=', '==', '!=', '>', '>=', 'in', 'not in', 'i...
  hasname = [90, 91, 95, 96, 97, 98, 101, 105, 107, 108, 116]
  HAVE_ARGUMENT = 90

Imports: sys, types


Function Details [hide private]

dis(x=None)

 

Disassemble classes, methods, functions, or code.

With no argument, disassemble the last traceback.

findlabels(code)

 

Detect all offsets in a byte code which are jump targets.

Return the list of offsets.

findlinestarts(code)

 

Find the offsets in a byte code which are start of lines in the source.

Generate pairs (offset, lineno) as described in Python/compile.c.


Variables Details [hide private]

opmap

Value:
{'BINARY_ADD': 23,
 'BINARY_AND': 64,
 'BINARY_DIVIDE': 21,
 'BINARY_FLOOR_DIVIDE': 26,
 'BINARY_LSHIFT': 62,
 'BINARY_MODULO': 22,
 'BINARY_MULTIPLY': 20,
 'BINARY_OR': 66,
...

opname

Value:
['STOP_CODE',
 'POP_TOP',
 'ROT_TWO',
 'ROT_THREE',
 'DUP_TOP',
 'ROT_FOUR',
 '<6>',
 '<7>',
...

cmp_op

Value:
('<',
 '<=',
 '==',
 '!=',
 '>',
 '>=',
 'in',
 'not in',
...