Skip to content

bpo-28810: Document remaining bytecode changes in 3.6 (GH-651) #808

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 24, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions Doc/library/dis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ interpreter.
between versions of Python. Use of this module should not be considered to
work across Python VMs or Python releases.

.. versionchanged:: 3.6
Use 2 bytes for each instruction. Previously the number of bytes varied
by instruction.


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

Expand Down Expand Up @@ -210,6 +214,11 @@ operation is being performed, so the intermediate analysis object isn't useful:
This generator function uses the ``co_firstlineno`` and ``co_lnotab``
attributes of the code object *code* to find the offsets which are starts of
lines in the source code. They are generated as ``(offset, lineno)`` pairs.
See :source:`Objects/lnotab_notes.txt` for the ``co_lnotab`` format and
how to decode it.

.. versionchanged:: 3.6
Line numbers can be decreasing. Before, they were always increasing.


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

This is not really an opcode. It identifies the dividing line between
opcodes which don't take arguments ``< HAVE_ARGUMENT`` and those which do
``>= HAVE_ARGUMENT``.
opcodes which don't use their argument and those that do
(``< HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively).

.. versionchanged:: 3.6
Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT``
ignore it. Before, only opcodes ``>= HAVE_ARGUMENT`` had an argument.


.. _opcode_collections:

Expand Down