PyDocs

Nav

Python Language Services

genops

pickletools

function (source)
  • genops(pickle)
Generate all the opcodes in a pickle.

'pickle' is a file-like object, or string, containing the pickle.

Each opcode in the pickle is generated, from the current pickle position,
stopping after a STOP opcode is delivered.  A triple is generated for
each opcode:

    opcode, arg, pos

opcode is an OpcodeInfo record, describing the current opcode.

If the opcode has an argument embedded in the pickle, arg is its decoded
value, as a Python object.  If the opcode doesn't have an argument, arg
is None.

If the pickle has a tell() method, pos was the value of pickle.tell()
before reading the current opcode.  If the pickle is a bytes object,
it's wrapped in a BytesIO object, and the latter's tell() result is
used.  Else (the pickle doesn't have a tell(), and it's not obvious how
to query its current position) pos is None.
0 Examples
No examples for pickletools/genops.
See Also
No see-alsos for pickletools/genops
0 Notes
No notes for genops