summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2021-04-02 12:24:57 (GMT)
committerGitHub <noreply@github.com>2021-04-02 12:24:57 (GMT)
commit58384c6ab01bbc35cc14cdeb716f6c45a3df426b (patch)
tree3dfe5585b6e61da1308d9e0dc88355b58c7b8db0 /Doc/c-api
parentbec8c787ec72d73b39011bde3f3a93e9bb1174b7 (diff)
downloadcpython-58384c6ab01bbc35cc14cdeb716f6c45a3df426b.zip
cpython-58384c6ab01bbc35cc14cdeb716f6c45a3df426b.tar.gz
cpython-58384c6ab01bbc35cc14cdeb716f6c45a3df426b.tar.bz2
Document PyCode_Addr2Line function. (GH-25111)
* Document PyCode_Addr2Line function. * Clarify when to use PEP 626 line iterators.
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/code.rst8
1 files changed, 8 insertions, 0 deletions
diff --git a/Doc/c-api/code.rst b/Doc/c-api/code.rst
index b3a17f1..6e18a42 100644
--- a/Doc/c-api/code.rst
+++ b/Doc/c-api/code.rst
@@ -51,3 +51,11 @@ bound into a function.
Return a new empty code object with the specified filename,
function name, and first line number. It is illegal to
:func:`exec` or :func:`eval` the resulting code object.
+
+.. c:function:: int PyCode_Addr2Line(PyCodeObject *co, int byte_offset)
+
+ Return the line number of the instruction that occurs on or before ``byte_offset`` and ends after it.
+ If you just need the line number of a frame, use :c:func:`PyFrame_GetLineNumber` instead.
+
+ For efficiently iterating over the line numbers in a code object, use `the API described in PEP 626
+ <https://www.python.org/dev/peps/pep-0626/#out-of-process-debuggers-and-profilers>`_.