Skip to content
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

[3.11] Docs: Amend codeobject.co_lines docs; end number is exclusive (GH-113970) #113988

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1246,20 +1246,20 @@ Methods on code objects

* ``start`` (an :class:`int`) represents the offset (inclusive) of the start
of the :term:`bytecode` range
* ``end`` (an :class:`int`) represents the offset (inclusive) of the end of
* ``end`` (an :class:`int`) represents the offset (exclusive) of the end of
the :term:`bytecode` range
* ``lineno`` is an :class:`int` representing the line number of the
:term:`bytecode` range, or ``None`` if the bytecodes in the given range
have no line number

The items yielded generated will have the following properties:
The items yielded will have the following properties:

* The first range yielded will have a ``start`` of 0.
* The ``(start, end)`` ranges will be non-decreasing and consecutive. That
is, for any pair of :class:`tuple`\s, the ``start`` of the second will be
equal to the ``end`` of the first.
* No range will be backwards: ``end >= start`` for all triples.
* The :class:`tuple` yielded will have ``end`` equal to the size of the
* The last :class:`tuple` yielded will have ``end`` equal to the size of the
:term:`bytecode`.

Zero-width ranges, where ``start == end``, are allowed. Zero-width ranges
Expand Down