mirror of
https://github.com/python/cpython.git
synced 2025-10-21 14:12:27 +00:00
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.
This commit is contained in:
parent
b8f704d219
commit
a42ca74fa3
12 changed files with 58 additions and 25 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue