bpo-46422: use dis.Positions in dis.Instruction (GH-30716)

Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
This commit is contained in:
Nikita Sobolev 2022-01-24 14:09:20 +03:00 committed by GitHub
parent 0367a36fdc
commit 58f3d98098
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 14 deletions

View file

@ -316,8 +316,30 @@ details of bytecode instructions as :class:`Instruction` instances:
``True`` if other code jumps to here, otherwise ``False``
.. data:: positions
:class:`dis.Positions` object holding the
start and end locations that are covered by this instruction.
.. versionadded:: 3.4
.. versionchanged:: 3.11
Field ``positions`` is added.
.. class:: Positions
In case the information is not available, some fields might be `None`.
.. data:: lineno
.. data:: end_lineno
.. data:: col_offset
.. data:: end_col_offset
.. versionadded:: 3.11
The Python compiler currently generates the following bytecode instructions.