Skip to content

gh-137528: Document the co_linetable code object attribute#151425

Open
harjothkhara wants to merge 1 commit into
python:mainfrom
harjothkhara:gh-137528-doc-co-linetable
Open

gh-137528: Document the co_linetable code object attribute#151425
harjothkhara wants to merge 1 commit into
python:mainfrom
harjothkhara:gh-137528-doc-co-linetable

Conversation

@harjothkhara

@harjothkhara harjothkhara commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Documents the public-but-implementation-detail codeobject.co_linetable attribute in the data model reference, which was previously undocumented.

The new entry in the "Special read-only attributes" table:

  • states it is a bytes object containing encoded source location information;
  • notes the exact format is an implementation detail that may change between Python versions;
  • explains it is made available to support the creation of new code objects (per PEP 626);
  • directs readers to co_lines() and co_positions() for supported access to line and position information.

A matching index entry and a .. versionadded:: 3.10 marker (the version that introduced co_linetable, per PEP 626) are included for consistency with the surrounding attributes.

Docs-only change, no runtime behavior change — skip news applies.

Built locally with make -C Doc html SPHINXOPTS='-W --keep-going' (clean, no warnings) and make -C Doc check.

Closes #137528

Document the public ``codeobject.co_linetable`` attribute in the data
model reference. It holds encoded source location information in an
opaque, version-specific format and is exposed to support the creation
of new code objects; readers are pointed to ``co_lines()`` and
``co_positions()`` for supported access.
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33120905 | 📁 Comparing 0a8c95b against main (f4f1020)

  🔍 Preview build  

1 file changed
± reference/datamodel.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

code.co_linetable is undocumented

1 participant