From 7c59d7c9860cdbaf4a9c26c9142aebd3259d046e Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 28 Apr 2020 16:32:48 +0200 Subject: bpo-40421: Add pyframe.h header file (GH-19755) Add a new separated pyframe.h header file of the PyFrame public C API: it is included by Python.h. Add PyFrame_GetLineNumber() to the limited C API. Replace "struct _frame" with "PyFrameObject" in header files. PyFrameObject is now defined as struct _frame by pyframe.h which is included early enough in Python.h. --- Objects/frameobject.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Objects/frameobject.c') diff --git a/Objects/frameobject.c b/Objects/frameobject.c index bdd7862b3c..d0a15e7751 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -34,10 +34,13 @@ frame_getlocals(PyFrameObject *f, void *closure) int PyFrame_GetLineNumber(PyFrameObject *f) { - if (f->f_trace) + assert(f != NULL); + if (f->f_trace) { return f->f_lineno; - else + } + else { return PyCode_Addr2Line(f->f_code, f->f_lasti); + } } static PyObject * -- cgit v1.2.1