Skip to content

Commit 93cc192

Browse files
Apply suggestions from code review
Co-authored-by: Alex Waygood <[email protected]>
1 parent b4d819d commit 93cc192

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

InternalDocs/code_objects.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,14 @@ representation of the source code positions of instructions, which are
7171
returned by the `co_positions()` iterator.
7272

7373
> [!NOTE]
74-
> Not to be confused by [`Objects/lnotab_notes.txt`](Objects/lnotab_notes.txt),
75-
> which describes the 3.10 format, that stores only that start line for each instruction.
76-
> For backwards compatibility this format is still supported by the `co_lnotab` property.
74+
> `co_linetable` is not to be confused with `co_lnotab`.
75+
> For backwards compatibility, `co_lnotab` stores the format
76+
> as it existed in Python 3.10 and lower: this older format
77+
> stores only the start line for each instruction.
78+
> See [`Objects/lnotab_notes.txt`](../Objects/lnotab_notes.txt) for more details.
7779
7880
`co_linetable` consists of a sequence of location entries.
79-
Each entry starts with a byte with the most significant bit set, followed by zero or more bytes with most significant bit unset.
81+
Each entry starts with a byte with the most significant bit set, followed by zero or more bytes with the most significant bit unset.
8082

8183
Each entry contains the following information:
8284
* The number of code units covered by this entry (length)
@@ -93,20 +95,20 @@ Bit 7 | Bits 3-6 | Bits 0-2
9395

9496
The codes are enumerated in the `_PyCodeLocationInfoKind` enum.
9597

96-
## Variable length integer encodings
98+
## Variable-length integer encodings
9799

98-
Integers are often encoded using a variable length integer encoding
100+
Integers are often encoded using a variable-length integer encoding
99101

100-
### Unsigned integers (varint)
102+
### Unsigned integers (`varint`)
101103

102-
Unsigned integers are encoded in 6 bit chunks, least significant first.
104+
Unsigned integers are encoded in 6-bit chunks, least significant first.
103105
Each chunk but the last has bit 6 set.
104106
For example:
105107

106108
* 63 is encoded as `0x3f`
107109
* 200 is encoded as `0x48`, `0x03`
108110

109-
### Signed integers (svarint)
111+
### Signed integers (`svarint`)
110112

111113
Signed integers are encoded by converting them to unsigned integers, using the following function:
112114
```Python

0 commit comments

Comments
 (0)