Skip to content

Commit e68806c

Browse files
authored
Docs: Amend codeobject.co_lines docs; end number is exclusive (#113970)
The end number should be exclusive, not inclusive.
1 parent 30e6cbd commit e68806c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Doc/reference/datamodel.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,20 +1263,20 @@ Methods on code objects
12631263

12641264
* ``start`` (an :class:`int`) represents the offset (inclusive) of the start
12651265
of the :term:`bytecode` range
1266-
* ``end`` (an :class:`int`) represents the offset (inclusive) of the end of
1266+
* ``end`` (an :class:`int`) represents the offset (exclusive) of the end of
12671267
the :term:`bytecode` range
12681268
* ``lineno`` is an :class:`int` representing the line number of the
12691269
:term:`bytecode` range, or ``None`` if the bytecodes in the given range
12701270
have no line number
12711271

1272-
The items yielded generated will have the following properties:
1272+
The items yielded will have the following properties:
12731273

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

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

0 commit comments

Comments
 (0)