代码对象 ¶
Code objects are a low-level detail of the CPython implementation. Each one represents a chunk of executable code that hasn’t yet been bound into a function.
-
type
PyCodeObject
¶
-
The C structure of the objects used to describe code objects. The fields of this type are subject to change at any time.
-
PyTypeObject
PyCode_Type
¶
-
This is an instance of
PyTypeObjectrepresenting the Python code object .
-
int
PyCode_Check
(
PyObject
*
co
)
¶
-
返回 True 若 co 是 code object . This function always succeeds.
-
Py_ssize_t
PyCode_GetNumFree
(
PyCodeObject
*
co
)
¶
-
返回数量为 free (closure) variables in a code object.
-
int
PyUnstable_Code_GetFirstFree
(
PyCodeObject
*
co
)
¶
-
这为 Unstable API . It may change without warning in minor releases.
Return the position of the first free (closure) variable in a code object.
Changed in version 3.13: Renamed from
PyCode_GetFirstFreeas part of Unstable C API . The old name is deprecated, but will remain available until the signature changes again.