aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-04-28 19:01:31 +0200
committerGitHub <noreply@github.com>2020-04-28 19:01:31 +0200
commita42ca74fa30227e2f89a619332557cf093a937d5 (patch)
treea3097e76897d8f8a0f054cab0736fd3cff80f8da /Include/pyframe.h
parentbpo-40421: Add Include/cpython/code.h header file (GH-19756) (diff)
downloadcpython-a42ca74fa30227e2f89a619332557cf093a937d5.tar.gz
cpython-a42ca74fa30227e2f89a619332557cf093a937d5.tar.bz2
cpython-a42ca74fa30227e2f89a619332557cf093a937d5.zip
bpo-40421: Add PyFrame_GetCode() function (GH-19757)
PyFrame_GetCode(frame): return a borrowed reference to the frame code. Replace frame->f_code with PyFrame_GetCode(frame) in most code, except in frameobject.c, genobject.c and ceval.c. Also add PyFrame_GetLineNumber() to the limited C API.
Diffstat (limited to 'Include/pyframe.h')
-rw-r--r--Include/pyframe.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/Include/pyframe.h b/Include/pyframe.h
index d3404cde4a1..3816224201c 100644
--- a/Include/pyframe.h
+++ b/Include/pyframe.h
@@ -14,6 +14,8 @@ typedef struct _frame PyFrameObject;
/* Return the line of code the frame is currently executing. */
PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *);
+PyAPI_FUNC(PyCodeObject *) PyFrame_GetCode(PyFrameObject *frame);
+
#ifdef __cplusplus
}
#endif