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.
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index d0a15e7..92206c5 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -1222,3 +1222,10 @@
                            numfree, sizeof(PyFrameObject));
 }
 
+
+PyCodeObject *
+PyFrame_GetCode(PyFrameObject *frame)
+{
+    assert(frame != NULL);
+    return frame->f_code;
+}