Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-96803: Document and test new unstable internal frame API functions #104211

Merged
merged 9 commits into from
May 18, 2023
35 changes: 35 additions & 0 deletions Doc/c-api/frame.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,38 @@ 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.
markshannon marked this conversation as resolved.
Show resolved Hide resolved

.. c:type:: struct _PyInterpreterFrame
AA-Turner marked this conversation as resolved.
Show resolved Hide resolved

This C structure for internal frames.
markshannon marked this conversation as resolved.
Show resolved Hide resolved

markshannon marked this conversation as resolved.
Show resolved Hide resolved

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

Get the code object for the frame
Returns a :term:`strong reference`.
markshannon marked this conversation as resolved.
Show resolved Hide resolved

.. versionadded:: 3.12


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

Gets the byte offset into the last executed instruction.
markshannon marked this conversation as resolved.
Show resolved Hide resolved

.. versionadded:: 3.12


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

Gets the currently executing line number, or -1 if there is no line number.
markshannon marked this conversation as resolved.
Show resolved Hide resolved

.. versionadded:: 3.12