Issue #9268: Add annotation option to pickletools.dis

This commit is contained in:
Alexander Belopolsky 2010-07-17 15:51:21 +00:00
parent f4e7a35d64
commit 929d384058
3 changed files with 54 additions and 12 deletions

View file

@ -13,14 +13,18 @@ ordinary users of the :mod:`pickle` module probably won't find the
:mod:`pickletools` module relevant.
.. function:: dis(pickle, out=None, memo=None, indentlevel=4)
.. function:: dis(pickle, out=None, memo=None, indentlevel=4, annotate=0)
Outputs a symbolic disassembly of the pickle to the file-like object *out*,
defaulting to ``sys.stdout``. *pickle* can be a string or a file-like object.
*memo* can be a Python dictionary that will be used as the pickle's memo; it can
be used to perform disassemblies across multiple pickles created by the same
pickler. Successive levels, indicated by ``MARK`` opcodes in the stream, are
indented by *indentlevel* spaces.
Outputs a symbolic disassembly of the pickle to the file-like
object *out*, defaulting to ``sys.stdout``. *pickle* can be a
string or a file-like object. *memo* can be a Python dictionary
that will be used as the pickle's memo; it can be used to perform
disassemblies across multiple pickles created by the same
pickler. Successive levels, indicated by ``MARK`` opcodes in the
stream, are indented by *indentlevel* spaces. If a nonzero value
is given to *annotate*, each opcode in the output is annotated with
a short description. The value of *annotate* is used as a hint for
the column where annotation should start.
.. function:: genops(pickle)