python / python/cpython

PyCode_Addr2Line point to out of date PEP 626

Open
#156,725 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs topic-C-API
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

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
  • gh-156736

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the PyCode_Addr2Line documentation and compare its PEP 626 reference with the renamed address-range functions described in the issue. Check the linked PR gh-156736 first; the documentation work is done when the complexity note and efficient-iteration guidance are accurate, with any future API exposure clearly separated.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.