Skip to content

Commit 7739eef

Browse files
Update code.rst
1 parent 17ae603 commit 7739eef

1 file changed

Lines changed: 3 additions & 15 deletions

File tree

‎Doc/c-api/code.rst‎

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,25 +96,13 @@ bound into a function.
9696
9797
Return the line number of the instruction that occurs on or before
9898
``byte_offset`` and ends after it. This is ``O(N)`` in the number of
99-
instructions in the code object, so it is not suitable for iterating over
99+
instructions in the code object, so it is not performant for iterating over
100100
all the line numbers in a code object.
101101
102102
If you just need the line number of a frame, use :c:func:`PyFrame_GetLineNumber` instead.
103103
104-
To iterate efficiently over the line numbers in a code object, use the
105-
private, unstable line-table iteration APIs declared in the private header
106-
``Include/internal/pycore_code.h``:
107-
108-
* ``_PyCode_InitAddressRange`` initializes a ``PyCodeAddressRange`` for a code object.
109-
* ``_PyLineTable_NextAddressRange`` advances the range to the next
110-
line-number entry.
111-
* ``_PyLineTable_PreviousAddressRange`` retreats the range to the
112-
previous entry.
113-
114-
.. warning::
115-
These functions are **internal and not a public C-API**. They are
116-
declared in a private header, may change or be removed without notice,
117-
and are not exported as stable symbols.
104+
For efficiently iterating over the line numbers in a code object, use :pep:`the API described in PEP 626
105+
<0626#out-of-process-debuggers-and-profilers>`.
118106
119107
.. c:function:: int PyCode_Addr2Location(PyObject *co, int byte_offset, int *start_line, int *start_column, int *end_line, int *end_column)
120108

0 commit comments

Comments
 (0)