summaryrefslogtreecommitdiff
path: root/Python/import.c
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 /Python/import.c
parentb8f704d2190125a7750b50cd9b67267b9c20fd43 (diff)
downloadcpython-git-a42ca74fa30227e2f89a619332557cf093a937d5.tar.gz
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 'Python/import.c')
-rw-r--r--Python/import.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/Python/import.c b/Python/import.c
index a8743458dd..9142ebba40 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -15,7 +15,6 @@
#include "errcode.h"
#include "marshal.h"
#include "code.h"
-#include "frameobject.h"
#include "importdl.h"
#include "pydtrace.h"
@@ -1536,7 +1535,7 @@ remove_importlib_frames(PyThreadState *tstate)
PyTracebackObject *traceback = (PyTracebackObject *)tb;
PyObject *next = (PyObject *) traceback->tb_next;
PyFrameObject *frame = traceback->tb_frame;
- PyCodeObject *code = frame->f_code;
+ PyCodeObject *code = PyFrame_GetCode(frame);
int now_in_importlib;
assert(PyTraceBack_Check(tb));