Python pickletools Module
Example
Disassemble a pickled byte stream to see its opcodes:
import pickle, pickletools
b = pickle.dumps({"x": 1})
pickletools.dis(b)
Try it Yourself »
Definition and Usage
The pickletools module helps you inspect and analyze pickled data.
Use it to disassemble pickle byte streams, optimize them, or iterate over individual opcodes.
Members
Member | Description |
---|---|
dis() | Print a human-readable disassembly of a pickled byte stream. |
genops() | Yield (opcode, arg, position) triples from a pickled byte stream. |
optimize() | Return a bytes object with a semantically equivalent but smaller pickle. |