From 8abc8a86f6133ab2b647a79e7578771363f63129 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Tue, 21 May 2024 17:23:34 -0400 Subject: [PATCH 1/3] gh-100117: Fix inaccuracy in documentation of the CodeObject's co_positions field. --- Doc/reference/datamodel.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 0fe9681f93f135..86825a26b5f630 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1243,9 +1243,10 @@ Methods on code objects The iterator returns :class:`tuple`\s containing the ``(start_line, end_line, start_column, end_column)``. The *i-th* tuple corresponds to the - position of the source code that compiled to the *i-th* instruction. - Column information is 0-indexed utf-8 byte offsets on the given source - line. + position of the source code that compiled to the *i-th* code unit. A + code unit is either a bytecode instruction or a cache entry of an + instruction. Column information is 0-indexed utf-8 byte offsets on the + given source line. This positional information can be missing. A non-exhaustive lists of cases where this may happen: From b4d2730e0db890a36c6bb3496c89d9a81436032d Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Fri, 31 May 2024 17:50:26 +0100 Subject: [PATCH 2/3] remove the incorrect code unit explanation --- Doc/reference/datamodel.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 86825a26b5f630..0c122aace0b3bb 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1243,10 +1243,8 @@ Methods on code objects The iterator returns :class:`tuple`\s containing the ``(start_line, end_line, start_column, end_column)``. The *i-th* tuple corresponds to the - position of the source code that compiled to the *i-th* code unit. A - code unit is either a bytecode instruction or a cache entry of an - instruction. Column information is 0-indexed utf-8 byte offsets on the - given source line. + position of the source code that compiled to the *i-th* code unit. + Column information is 0-indexed utf-8 byte offsets on the given source line. This positional information can be missing. A non-exhaustive lists of cases where this may happen: From e254c0e0fc74606b36094e76615c1dcfc4f7c7b5 Mon Sep 17 00:00:00 2001 From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Fri, 31 May 2024 17:51:37 +0100 Subject: [PATCH 3/3] whitespace --- Doc/reference/datamodel.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 0c122aace0b3bb..134385ed2f1860 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1244,7 +1244,8 @@ Methods on code objects The iterator returns :class:`tuple`\s containing the ``(start_line, end_line, start_column, end_column)``. The *i-th* tuple corresponds to the position of the source code that compiled to the *i-th* code unit. - Column information is 0-indexed utf-8 byte offsets on the given source line. + Column information is 0-indexed utf-8 byte offsets on the given source + line. This positional information can be missing. A non-exhaustive lists of cases where this may happen: