diff options
author | Victor Stinner <vstinner@python.org> | 2020-04-28 22:56:58 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-28 22:56:58 (GMT) |
commit | 6d86a2331e6b64a2ae80c1a21f81baa5a71ac594 (patch) | |
tree | 43b1e88fff7e3122019b4d948758534aeed39a87 /Objects/genobject.c | |
parent | 521c8d6806adf0305c158d280ec00cca48e8ab22 (diff) | |
download | cpython-6d86a2331e6b64a2ae80c1a21f81baa5a71ac594.zip cpython-6d86a2331e6b64a2ae80c1a21f81baa5a71ac594.tar.gz cpython-6d86a2331e6b64a2ae80c1a21f81baa5a71ac594.tar.bz2 |
bpo-40429: PyFrame_GetCode() result cannot be NULL (GH-19772)
Add frame_nslots() to factorize duplicate code.
Diffstat (limited to 'Objects/genobject.c')
-rw-r--r-- | Objects/genobject.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Objects/genobject.c b/Objects/genobject.c index 66c6ccb..071def8 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -1117,11 +1117,11 @@ compute_cr_origin(int origin_depth) } frame = PyEval_GetFrame(); for (int i = 0; i < frame_count; ++i) { - PyObject *frameinfo = Py_BuildValue( - "OiO", - frame->f_code->co_filename, - PyFrame_GetLineNumber(frame), - frame->f_code->co_name); + PyCodeObject *code = frame->f_code; + PyObject *frameinfo = Py_BuildValue("OiO", + code->co_filename, + PyFrame_GetLineNumber(frame), + code->co_name); if (!frameinfo) { Py_DECREF(cr_origin); return NULL; |