Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8def876

Browse files
committed
[Bug #873146] Document pickletools module (haven't tested the LaTeX yet)
1 parent d0c53fe commit 8def876

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

Doc/lib/lib.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ \chapter*{Front Matter\label{front}}
322322
\input{libpycompile} % really py_compile
323323
\input{libcompileall}
324324
\input{libdis}
325+
\input{libpickletools}
325326
\input{distutils}
326327

327328
\input{compiler} % compiler package

Doc/lib/libpickletools.tex

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
\section{\module{pickletools} --- Tools for pickle developers.}
2+
3+
\declaremodule{standard}{pickletools}
4+
\modulesynopsis{Contains extensive comments about the pickle protocols and pickle-machine opcodes, as well as some useful functions.}
5+
6+
This module contains various constants relating to the intimate
7+
details of the \refmodule{pickle} module, some lengthy comments about
8+
the implementation, and a few useful functions for analyzing pickled
9+
data. The contents of this module are useful for Python core
10+
developers who are working on the \module{pickle} and \module{cPickle}
11+
implementations; ordinary users of the \module{pickle} module probably
12+
won't find the \module{pickletools} module relevant.
13+
14+
\begin{funcdesc}{dis}{pickle\optional{, out=None, memo=None, indentlevel=4}}
15+
Outputs a symbolic disassembly of the pickle to the file-like object
16+
\var{out}, defaulting to \code{sys.stdout}. \var{pickle} can be a
17+
string or a file-like object. \var{memo} can be a Python dictionary
18+
that will be used as the pickle's memo; it can be used to perform
19+
disassemblies across multiple pickles created by the same pickler.
20+
Successive levels, indicated by \code{MARK} opcodes in the stream, are
21+
indented by \var{indentlevel} spaces.
22+
\end{funcdesc}
23+
24+
\begin{funcdesc}{genops}{pickle}
25+
Provides an iterator over all of the opcodes in a pickle, returning a
26+
sequence of \code{(\var{opcode}, \var{arg}, \var{pos})} triples.
27+
\var{opcode} is an instance of an \class{OpcodeInfo} class; \var{arg}
28+
is the decoded value, as a Python object, of the opcode's argument;
29+
\var{pos} is the position at which this opcode is located.
30+
\var{pickle} can be a string or a file-like object.
31+
\end{funcdesc}
32+

0 commit comments

Comments
 (0)