diff options
| author | Victor Stinner <vstinner@python.org> | 2020-04-28 19:01:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-28 19:01:31 +0200 |
| commit | a42ca74fa30227e2f89a619332557cf093a937d5 (patch) | |
| tree | a3097e76897d8f8a0f054cab0736fd3cff80f8da /Objects/frameobject.c | |
| parent | b8f704d2190125a7750b50cd9b67267b9c20fd43 (diff) | |
| download | cpython-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 'Objects/frameobject.c')
| -rw-r--r-- | Objects/frameobject.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c index d0a15e7751..92206c5f52 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -1222,3 +1222,10 @@ _PyFrame_DebugMallocStats(FILE *out) numfree, sizeof(PyFrameObject)); } + +PyCodeObject * +PyFrame_GetCode(PyFrameObject *frame) +{ + assert(frame != NULL); + return frame->f_code; +} |
