On this page
pickletools.genops
Prev: pickletools.dis | Up: pickletools | Next: pickletools.optimize
Rel: pickletools.dis, pickletools.optimize
Ref: docs.python.org — pickletools.genops
Tags: #public #python3 #stdlib #pickletools
Import
import pickletools
from pickletools import genops
Signature & Overview
pickletools.genops(pickle)
Generate all the opcodes in a pickle.
Usage
import pickle
import pickletools
ops = [op.name for op, _arg, _pos in pickletools.genops(pickle.dumps([1, 2]))]
assert ops[-1] == "STOP"
Gotchas
- Programmatic opcode iterator: Great for auditing pickle streams for
GLOBAL/REDUCEopcodes.
REPL Inspect
from pickletools import genops
help(genops)
Linked from
Related notes
- tuts/python3/stdlib_module/pickletools/dis Linked here; links to this page; shared tags: #pickletools, #stdlib
- tuts/python3/stdlib_module/pickletools/optimize Linked here; links to this page; shared tags: #pickletools, #stdlib
- tuts/python3/stdlib_module/pickletools Linked here; links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib
- tuts/c/stdlib/ctype/isalpha shared tags: #stdlib
- tuts/c/stdlib/ctype/isdigit shared tags: #stdlib