Skip to content

Commit 74bfcc3

Browse files
authored
bpo-28810: Document remaining bytecode changes in 3.6 (GH-651) (GH-808)
(cherry picked from commit 8f9e1bb)
1 parent 8c8785b commit 74bfcc3

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Doc/library/dis.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ interpreter.
2020
between versions of Python. Use of this module should not be considered to
2121
work across Python VMs or Python releases.
2222

23+
.. versionchanged:: 3.6
24+
Use 2 bytes for each instruction. Previously the number of bytes varied
25+
by instruction.
26+
2327

2428
Example: Given the function :func:`myfunc`::
2529

@@ -210,6 +214,11 @@ operation is being performed, so the intermediate analysis object isn't useful:
210214
This generator function uses the ``co_firstlineno`` and ``co_lnotab``
211215
attributes of the code object *code* to find the offsets which are starts of
212216
lines in the source code. They are generated as ``(offset, lineno)`` pairs.
217+
See :source:`Objects/lnotab_notes.txt` for the ``co_lnotab`` format and
218+
how to decode it.
219+
220+
.. versionchanged:: 3.6
221+
Line numbers can be decreasing. Before, they were always increasing.
213222

214223

215224
.. function:: findlabels(code)
@@ -1105,8 +1114,13 @@ All of the following opcodes use their arguments.
11051114
.. opcode:: HAVE_ARGUMENT
11061115

11071116
This is not really an opcode. It identifies the dividing line between
1108-
opcodes which don't take arguments ``< HAVE_ARGUMENT`` and those which do
1109-
``>= HAVE_ARGUMENT``.
1117+
opcodes which don't use their argument and those that do
1118+
(``< HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively).
1119+
1120+
.. versionchanged:: 3.6
1121+
Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT``
1122+
ignore it. Before, only opcodes ``>= HAVE_ARGUMENT`` had an argument.
1123+
11101124

11111125
.. _opcode_collections:
11121126

0 commit comments

Comments
 (0)