summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/init.rst6
-rw-r--r--Doc/c-api/reflection.rst9
-rw-r--r--Doc/whatsnew/3.9.rst4
3 files changed, 17 insertions, 2 deletions
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst
index 435808f..afde3db 100644
--- a/Doc/c-api/init.rst
+++ b/Doc/c-api/init.rst
@@ -1074,8 +1074,10 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
.. c:function:: PyFrameObject* PyThreadState_GetFrame(PyThreadState *tstate)
- Get the current frame of the Python thread state *tstate*. It can be
- ``NULL`` if no frame is currently executing.
+ Get a borrowed reference to the current frame of the Python thread state
+ *tstate*.
+
+ Return ``NULL`` if no frame is currently executing.
See also :c:func:`PyEval_GetFrame`.
diff --git a/Doc/c-api/reflection.rst b/Doc/c-api/reflection.rst
index 498219f..b313ea3 100644
--- a/Doc/c-api/reflection.rst
+++ b/Doc/c-api/reflection.rst
@@ -31,6 +31,15 @@ Reflection
See also :c:func:`PyThreadState_GetFrame`.
+.. c:function:: int PyFrame_GetCode(PyFrameObject *frame)
+
+ Return a borrowed reference to the *frame* code.
+
+ *frame* must not be ``NULL``.
+
+ .. versionadded:: 3.9
+
+
.. c:function:: int PyFrame_GetLineNumber(PyFrameObject *frame)
Return the line number that *frame* is currently executing.
diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst
index 8b8aa9a..e3751fa 100644
--- a/Doc/whatsnew/3.9.rst
+++ b/Doc/whatsnew/3.9.rst
@@ -537,6 +537,10 @@ Optimizations
Build and C API Changes
=======================
+* New :c:func:`PyFrame_GetCode` function: return a borrowed reference to the
+ frame code.
+ (Contributed by Victor Stinner in :issue:`40421`.)
+
* Add :c:func:`PyFrame_GetLineNumber` to the limited C API.
(Contributed by Victor Stinner in :issue:`40421`.)