Skip to content
34 changes: 34 additions & 0 deletions Doc/c-api/frame.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,37 @@ See also :ref:`Reflection <reflection>`.
.. c:function:: int PyFrame_GetLineNumber(PyFrameObject *frame)

Return the line number that *frame* is currently executing.



Internal Frames
---------------

Unless using PEP 523, you will not need this.
Comment thread
markshannon marked this conversation as resolved.
Outdated

.. c:type:: struct _PyInterpreterFrame
Comment thread
AA-Turner marked this conversation as resolved.
Outdated

The interpreter's internal frame representation.

Comment thread
markshannon marked this conversation as resolved.

.. c:function:: PyCodeObject* PyUnstable_InterpreterFrame_GetCode(struct _PyInterpreterFrame *frame);

Return a :term:`strong reference` to the code object for the frame.

.. versionadded:: 3.12


.. c:function:: int PyUnstable_InterpreterFrame_GetLasti(struct _PyInterpreterFrame *frame);

Return the byte offset into the last executed instruction.

.. versionadded:: 3.12


.. c:function:: int PyUnstable_InterpreterFrame_GetLine(struct _PyInterpreterFrame *frame);

Return the currently executing line number, or -1 if there is no line number.
Comment thread
markshannon marked this conversation as resolved.
Outdated

.. versionadded:: 3.12