Skip to content

Commit 7cb033c

Browse files
authored
bpo-43494: Make some minor changes to lnotab notes (GH-24861)
This cleanup makes no substantive changes.
1 parent 148bc05 commit 7cb033c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Objects/lnotab_notes.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ Description of the internal format of the line number table
33
Conceptually, the line number table consists of a sequence of triples:
44
start-offset (inclusive), end-offset (exclusive), line-number.
55

6-
Note that note all byte codes have a line number so we need handle `None` for the line-number.
6+
Note that not all byte codes have a line number so we need handle `None` for the line-number.
77

88
However, storing the above sequence directly would be very inefficient as we would need 12 bytes per entry.
99

10-
First of all, we can note that the end of one entry is the same as the start of the next, so we can overlap entries.
11-
Secondly we also note that we don't really need arbitrary access to the sequence, so we can store deltas.
10+
First, note that the end of one entry is the same as the start of the next, so we can overlap entries.
11+
Second, we don't really need arbitrary access to the sequence, so we can store deltas.
1212

1313
We just need to store (end - start, line delta) pairs. The start offset of the first entry is always zero.
1414

15-
Thirdly, most deltas are small, so we can use a single byte for each value, as long we allow several entries for the same line.
15+
Third, most deltas are small, so we can use a single byte for each value, as long we allow several entries for the same line.
1616

1717
Consider the following table
1818
Start End Line
@@ -36,12 +36,12 @@ Stripping the redundant ends gives:
3636

3737
Note that the end - start value is always positive.
3838

39-
Finally in order, to fit into a single byte we need to convert start deltas to the range 0 <= delta <= 254,
39+
Finally, in order to fit into a single byte we need to convert start deltas to the range 0 <= delta <= 254,
4040
and line deltas to the range -127 <= delta <= 127.
4141
A line delta of -128 is used to indicate no line number.
4242
A start delta of 255 is used as a sentinel to mark the end of the table.
4343
Also note that a delta of zero indicates that there are no bytecodes in the given range,
44-
which means can use an invalidate line number for that range.
44+
which means we can use an invalid line number for that range.
4545

4646
Final form:
4747

0 commit comments

Comments
 (0)