summaryrefslogtreecommitdiff
path: root/Objects/frameobject.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-04-28 16:32:48 +0200
committerGitHub <noreply@github.com>2020-04-28 16:32:48 +0200
commit7c59d7c9860cdbaf4a9c26c9142aebd3259d046e (patch)
tree25d14f4febac1b124878b5875a936b47c6706771 /Objects/frameobject.c
parent5da352616fb8290e3c2c0245f553280824093c6a (diff)
downloadcpython-git-7c59d7c9860cdbaf4a9c26c9142aebd3259d046e.tar.gz
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.
Diffstat (limited to 'Objects/frameobject.c')
-rw-r--r--Objects/frameobject.c7
1 files changed, 5 insertions, 2 deletions
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 *