帧对象¶
- 
type PyFrameObject¶
-  属于 受限 API (作为不透明的结构体).用于描述帧对象的对象C结构体。 此结构体中无公有成员。 在 3.11 版本发生变更: 此结构体的成员已从公有 C API 中移除。 请参阅 What's New entry 了解详情。 
可以使用函数 PyEval_GetFrame() 与 PyThreadState_GetFrame() 去获取一个帧对象。
可参考:Reflection 1
- 
PyTypeObject PyFrame_Type¶
- 帧对象的类型。 它与 Python 层中的 - types.FrameType是同一对象。- 在 3.11 版本发生变更: 在之前版本中,此类型仅在包括 - <frameobject.h>之后可用。
- 
int PyFrame_Check(PyObject *obj)¶
- 如果 obj 是一个帧对象则返回非零值。 - 在 3.11 版本发生变更: 在之前版本中,只函数仅在包括 - <frameobject.h>之后可用。
- 
PyFrameObject *PyFrame_GetBack(PyFrameObject *frame)¶
- 获取 frame 为下一个外部帧。 - 返回一个 strong reference,或者如果 frame 没有外部帧则返回 - NULL。- 在 3.9 版本加入. 
- 
PyObject *PyFrame_GetBuiltins(PyFrameObject *frame)¶
- 获取 frame 的 - f_builtins属性。- 返回一个 strong reference。 此结果不可为 - NULL。- 在 3.11 版本加入. 
- 
PyCodeObject *PyFrame_GetCode(PyFrameObject *frame)¶
-  属于 稳定 ABI 自 3.10 版起.获取 frame 的代码。 返回一个 strong reference。 结果(帧代码)不可为 NULL。在 3.9 版本加入. 
- 
PyObject *PyFrame_GetGenerator(PyFrameObject *frame)¶
- 获取拥有该帧的生成器、协程或异步生成器,或者如果该帧不被某个生成器所拥有则为 - NULL。 不会引发异常,即使其返回值为- NULL。- 返回一个 strong reference,或者 - NULL。- 在 3.11 版本加入. 
- 
PyObject *PyFrame_GetGlobals(PyFrameObject *frame)¶
- 获取 frame 的 - f_globals属性。- 返回一个 strong reference。 此结果不可为 - NULL。- 在 3.11 版本加入. 
- 
int PyFrame_GetLasti(PyFrameObject *frame)¶
- 获取 frame 的 - f_lasti属性。- 如果 - frame.f_lasti为- None则返回 -1。- 在 3.11 版本加入. 
- 
PyObject *PyFrame_GetLocals(PyFrameObject *frame)¶
- 获取 frame 的 - f_locals属性 (- dict)。- 返回一个 strong reference。 - 在 3.11 版本加入. 
- 
int PyFrame_GetLineNumber(PyFrameObject *frame)¶
-  属于 稳定 ABI 自 3.10 版起.返回 frame 当前正在执行的行号。