bpo-40421: Add PyFrame_GetBack() function (GH-19765)
New PyFrame_GetBack() function: get the frame next outer frame.
Replace frame->f_back with PyFrame_GetBack(frame) in most code but
frameobject.c, ceval.c and genobject.c.
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 6d288b5..451c895 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -1237,3 +1237,13 @@
Py_INCREF(code);
return code;
}
+
+
+PyFrameObject*
+PyFrame_GetBack(PyFrameObject *frame)
+{
+ assert(frame != NULL);
+ PyFrameObject *back = frame->f_back;
+ Py_XINCREF(back);
+ return back;
+}