Skip to content

PyCode_Addr2Line point to out of date PEP 626 #156725

Open

Description

@colesbury

Documentation

The docs for PyCode_Addr2Line say:

For efficiently iterating over the line numbers in a code object, use the API described in PEP 626.

That section of the PEP describes PyCodeAddressRange, PyLineTable_InitAddressRange, PyLineTable_NextAddressRange, and PyLineTable_PreviousAddressRange . Those function have been renamed with a _ prefix. Some are not exported symbols (even in private headers). That's fine for the PEP, we treat them as historical documents, but the docs should be up to date.

Ideally we:

  1. Document that PyCode_Addr2Line may be O(N) in the size of the code. This is important and not obvious!
  2. Describe how to iterate efficiently in the docs.
  3. In a future version of Python, expose the functions as public, documented, unstable C APIs. (I think PyUnstable makes sense for these)

Linked PRs

Activity

  1. added a commit that references this issue on Aug 31, 2026
  2. LeonxLJX commented on Sep 3, 2026

    @LeonxLJX

    I'd like to take this one.

    Reading the issue, this looks like a documentation-clarity gap rather than a code defect: the current page doesn't give readers enough to self-diagnose, which is why it surfaces here as an issue instead of being answered by the docs.

    Plan: locate the relevant section, confirm what the code actually does today (so the docs match behavior, not intent), tighten the wording, and scan neighboring pages for the same inconsistency — otherwise the fix just relocates the confusion.

    One thing to confirm before writing: minimal correction scoped to this page, or also cross-link from related guides if the same gap shows up there?

    (claiming via @LeonxLJX)

  3. added 2 commits that reference this issue on Sep 28, 2026
  4. added 3 commits that reference this issue on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions