summaryrefslogtreecommitdiffstats
path: root/Doc/library/dis.rst
diff options
context:
space:
mode:
authorCorvin <corvin@corvin.dev>2023-08-25 08:31:26 (GMT)
committerGitHub <noreply@github.com>2023-08-25 08:31:26 (GMT)
commit24aa249a6633249570978d6aae6f7b21581ee085 (patch)
treec0d7e8f55b9005b6d0200a67f540d3dda3950c2b /Doc/library/dis.rst
parent8d4052075ec43ac1ded7d2fa55c474295410bbdc (diff)
downloadcpython-24aa249a6633249570978d6aae6f7b21581ee085.zip
cpython-24aa249a6633249570978d6aae6f7b21581ee085.tar.gz
cpython-24aa249a6633249570978d6aae6f7b21581ee085.tar.bz2
gh-107932: Fix dis module for bytecode that does not have an associated source line (GH-107988)
Diffstat (limited to 'Doc/library/dis.rst')
-rw-r--r--Doc/library/dis.rst15
1 files changed, 13 insertions, 2 deletions
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst
index 0b44d16..7c3363b 100644
--- a/Doc/library/dis.rst
+++ b/Doc/library/dis.rst
@@ -297,6 +297,9 @@ operation is being performed, so the intermediate analysis object isn't useful:
The :pep:`626` ``co_lines`` method is used instead of the ``co_firstlineno``
and ``co_lnotab`` attributes of the code object.
+ .. versionchanged:: 3.13
+ Line numbers can be ``None`` for bytecode that does not map to source lines.
+
.. function:: findlabels(code)
@@ -402,7 +405,12 @@ details of bytecode instructions as :class:`Instruction` instances:
.. data:: starts_line
- line started by this opcode (if any), otherwise ``None``
+ ``True`` if this opcode starts a source line, otherwise ``False``
+
+
+ .. data:: line_number
+
+ source line number associated with this opcode (if any), otherwise ``None``
.. data:: is_jump_target
@@ -429,8 +437,11 @@ details of bytecode instructions as :class:`Instruction` instances:
.. versionchanged:: 3.13
+ Changed field ``starts_line``.
+
Added fields ``start_offset``, ``cache_offset``, ``end_offset``,
- ``baseopname``, ``baseopcode``, ``jump_target`` and ``oparg``.
+ ``baseopname``, ``baseopcode``, ``jump_target``, ``oparg``, and
+ ``line_number``.
.. class:: Positions