Skip to content

Commit 8f9e1bb

Browse files
ilevkivskyibrettcannon
authored andcommitted
bpo-28810: Document remaining bytecode changes in 3.6 (GH-651)
1 parent 671079e commit 8f9e1bb

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)
@@ -1127,8 +1136,13 @@ All of the following opcodes use their arguments.
11271136
.. opcode:: HAVE_ARGUMENT
11281137

11291138
This is not really an opcode. It identifies the dividing line between
1130-
opcodes which don't take arguments ``< HAVE_ARGUMENT`` and those which do
1131-
``>= HAVE_ARGUMENT``.
1139+
opcodes which don't use their argument and those that do
1140+
(``< HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively).
1141+
1142+
.. versionchanged:: 3.6
1143+
Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT``
1144+
ignore it. Before, only opcodes ``>= HAVE_ARGUMENT`` had an argument.
1145+
11321146

11331147
.. _opcode_collections:
11341148

0 commit comments

Comments
 (0)