summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSkip Montanaro <skip.montanaro@gmail.com>2021-03-19 23:10:54 (GMT)
committerGitHub <noreply@github.com>2021-03-19 23:10:54 (GMT)
commit7cb033c423b65def1632d6c3c747111543b342a2 (patch)
tree5777c63973f4e38a82f902539c26edc67898ecd0 /Objects
parent148bc0584476d836b65d65e158354f15b56d27b5 (diff)
downloadcpython-7cb033c423b65def1632d6c3c747111543b342a2.zip
cpython-7cb033c423b65def1632d6c3c747111543b342a2.tar.gz
cpython-7cb033c423b65def1632d6c3c747111543b342a2.tar.bz2
bpo-43494: Make some minor changes to lnotab notes (GH-24861)
This cleanup makes no substantive changes.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/lnotab_notes.txt12
1 files changed, 6 insertions, 6 deletions
diff --git a/Objects/lnotab_notes.txt b/Objects/lnotab_notes.txt
index 046f753..59c6525 100644
--- a/Objects/lnotab_notes.txt
+++ b/Objects/lnotab_notes.txt
@@ -3,16 +3,16 @@ Description of the internal format of the line number table
Conceptually, the line number table consists of a sequence of triples:
start-offset (inclusive), end-offset (exclusive), line-number.
-Note that note all byte codes have a line number so we need handle `None` for the line-number.
+Note that not all byte codes have a line number so we need handle `None` for the line-number.
However, storing the above sequence directly would be very inefficient as we would need 12 bytes per entry.
-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.
-Secondly we also note that we don't really need arbitrary access to the sequence, so we can store deltas.
+First, note that the end of one entry is the same as the start of the next, so we can overlap entries.
+Second, we don't really need arbitrary access to the sequence, so we can store deltas.
We just need to store (end - start, line delta) pairs. The start offset of the first entry is always zero.
-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.
+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.
Consider the following table
Start End Line
@@ -36,12 +36,12 @@ Stripping the redundant ends gives:
Note that the end - start value is always positive.
-Finally in order, to fit into a single byte we need to convert start deltas to the range 0 <= delta <= 254,
+Finally, in order to fit into a single byte we need to convert start deltas to the range 0 <= delta <= 254,
and line deltas to the range -127 <= delta <= 127.
A line delta of -128 is used to indicate no line number.
A start delta of 255 is used as a sentinel to mark the end of the table.
Also note that a delta of zero indicates that there are no bytecodes in the given range,
-which means can use an invalidate line number for that range.
+which means we can use an invalid line number for that range.
Final form: