Skip to content

PyCode_Addr2Line point to out of date PEP 626 #156725

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions