Skip to content

Commit dfc672b

Browse files
committed
mark's comments
1 parent 93cc192 commit dfc672b

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

InternalDocs/code_objects.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ Code objects are typically produced by the bytecode [compiler](compiler.md),
1919
although they are often written to disk by one process and read back in by another.
2020
The disk version of a code object is serialized using the
2121
[marshal](https://docs.python.org/dev/library/marshal.html) protocol.
22-
Some code objects are pre-loaded into the interpreter using
23-
[`Tools/build/deepfreeze.py`](../Tools/build/deepfreeze.py),
24-
which writes
25-
[`Python/deepfreeze/deepfreeze.c`](../Python/deepfreeze/deepfreeze.c).
2622

2723
Code objects are nominally immutable.
2824
Some fields (including `co_code_adaptive` and fields for runtime
@@ -58,8 +54,8 @@ compact, but doesn't return end line numbers or column offsets.
5854
From C code, you need to call
5955
[`PyCode_Addr2Location`](https://docs.python.org/dev/c-api/code.html#c.PyCode_Addr2Location).
6056

61-
As the locations table is only consulted by exception handling (to set ``tb_lineno``)
62-
and by tracing (to pass the line number to the tracing function), lookup is not
57+
As the locations table is only consulted when displaying a traceback and when
58+
tracing (to pass the line number to the tracing function), lookup is not
6359
performance critical.
6460
In order to reduce the overhead during tracing, the mapping from instruction offset to
6561
line number is cached in the ``_co_linearray`` field.
@@ -72,9 +68,10 @@ returned by the `co_positions()` iterator.
7268

7369
> [!NOTE]
7470
> `co_linetable` is not to be confused with `co_lnotab`.
75-
> For backwards compatibility, `co_lnotab` stores the format
71+
> For backwards compatibility, `co_lnotab` exposes the format
7672
> as it existed in Python 3.10 and lower: this older format
7773
> stores only the start line for each instruction.
74+
> It is lazily created from `co_linetable` when accessed.
7875
> See [`Objects/lnotab_notes.txt`](../Objects/lnotab_notes.txt) for more details.
7976
8077
`co_linetable` consists of a sequence of location entries.

0 commit comments

Comments
 (0)