PyDocs

Nav

Python Language Services

Instruction

dis

class · Added in 3.4 (source)
  • Instruction(opname, opcode, arg, argval, argrepr, offset, start_offset, starts_line, line_number, label=None, positions=None, cache_info=None)
Details for a bytecode operation.

Defined fields:
  opname - human readable name for operation
  opcode - numeric code for operation
  arg - numeric argument to operation (if any), otherwise None
  argval - resolved arg value (if known), otherwise same as arg
  argrepr - human readable description of operation argument
  offset - start index of operation within bytecode sequence
  start_offset - start index of operation within bytecode sequence including extended args if present;
                 otherwise equal to Instruction.offset
  starts_line - True if this opcode starts a source line, otherwise False
  line_number - source line number associated with this opcode (if any), otherwise None
  label - A label if this instruction is a jump target, otherwise None
  positions - Optional dis.Positions object holding the span of source code
              covered by this instruction
  cache_info - information about the format and content of the instruction's cache
                 entries (if any)
Changed in 3.11, 3.13
  • 3.11: Field positions is added.
  • 3.13: Changed field starts_line. Added fields start_offset, cache_offset, end_offset, baseopname, baseopcode, jump_target, oparg, line_number and cache_info.
Members of Instruction

a

arg
Numeric argument to operation (if any), otherwise None
argrepr
Human readable description of operation argument
argval
Resolved arg value (if known), otherwise same as arg

b

baseopcode
Numeric code for the base operation if operation is specialized.
baseopname
Human readable name for the base operation if operation is specialized.

c

cache_info
list of (name, size, data), one for each cache entry of the instruction
cache_offset
Start index of the cache entries following the operation.

e

end_offset
End index of the cache entries following the operation.

i

is_jump_target
True if other code jumps to here, otherwise False

j

jump_target
Bytecode index of the jump target if this is a jump operation.

l

line_number
source line number associated with this opcode (if any), otherwise None

o

offset
Start index of operation within bytecode sequence
oparg
Alias for Instruction.arg.
opcode
Numeric code for operation
opname
Human readable name for operation

p

positions
dis.Positions object holding the span of source code covered by this instruction

s

start_offset
Start index of operation within bytecode sequence, including extended args if present; otherwise equal to Instruction.offset
starts_line
True if this opcode starts a source line, otherwise False
0 Examples
No examples for dis/Instruction.
See Also
No see-alsos for dis/Instruction
0 Notes
No notes for Instruction