@@ -19,10 +19,6 @@ Code objects are typically produced by the bytecode [compiler](compiler.md),
1919although they are often written to disk by one process and read back in by another.
2020The 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
2723Code objects are nominally immutable.
2824Some fields (including ` co_code_adaptive ` and fields for runtime
@@ -58,8 +54,8 @@ compact, but doesn't return end line numbers or column offsets.
5854From 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
6359performance critical.
6460In order to reduce the overhead during tracing, the mapping from instruction offset to
6561line 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