Skip to content

Commit c819cac

Browse files
committed
gh-151950: Fix dangling reference in pickletools docs
1 parent 285d96d commit c819cac

2 files changed

Lines changed: 39 additions & 4 deletions

File tree

Doc/library/pickletools.rst

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,47 @@ Programmatic interface
107107
.. function:: genops(pickle)
108108

109109
Provides an :term:`iterator` over all of the opcodes in a pickle, returning a
110-
sequence of ``(opcode, arg, pos)`` triples. *opcode* is an instance of an
111-
:class:`OpcodeInfo` class; *arg* is the decoded value, as a Python object, of
112-
the opcode's argument; *pos* is the position at which this opcode is located.
110+
sequence of ``(opcode, arg, pos)`` triples. *opcode* is an instance of
111+
:class:`OpcodeInfo`; *arg* is the decoded value, as a Python object, of the
112+
opcode's argument; *pos* is the position at which this opcode is located.
113113
*pickle* can be a string or a file-like object.
114114

115+
.. class:: OpcodeInfo
116+
117+
Represents information about a pickle opcode.
118+
119+
Instances of this class are returned as the first element of the tuples
120+
yielded by :func:`genops`.
121+
122+
.. attribute:: name
123+
124+
The symbolic name of the opcode.
125+
126+
.. attribute:: code
127+
128+
The one-character opcode value.
129+
130+
.. attribute:: arg
131+
132+
The descriptor for the opcode argument, or ``None`` if the opcode has
133+
no argument.
134+
135+
.. attribute:: stack_before
136+
137+
A list describing the stack before the opcode executes.
138+
139+
.. attribute:: stack_after
140+
141+
A list describing the stack after the opcode executes.
142+
143+
.. attribute:: proto
144+
145+
The pickle protocol version in which the opcode was introduced.
146+
147+
.. attribute:: doc
148+
149+
A human-readable description of the opcode.
150+
115151
.. function:: optimize(picklestring)
116152

117153
Returns a new equivalent pickle string after eliminating unused ``PUT``

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Doc/library/lzma.rst
1818
Doc/library/mmap.rst
1919
Doc/library/multiprocessing.rst
2020
Doc/library/optparse.rst
21-
Doc/library/pickletools.rst
2221
Doc/library/pyexpat.rst
2322
Doc/library/select.rst
2423
Doc/library/socket.rst

0 commit comments

Comments
 (0)