Function

Function

PyFunctionObject

C

PyTypeObject PyFunction_Type

PyTypeObject Python Python types.FunctionType

int PyFunction_Check(PyObject *o)

o (PyFunction_Type ) true NULL

PyObject* PyFunction_New(PyObject *code, PyObject *globals)
Return value: New reference.

code globals

__module__ globals NULL __qualname__

PyObject* PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname)
Return value: New reference.

PyFunction_New() __qualname__ qualname NULL ; NULL __qualname__ __name__

3.3 .

PyObject* PyFunction_GetCode(PyObject *op)
Return value: Borrowed reference.

op

PyObject* PyFunction_GetGlobals(PyObject *op)
Return value: Borrowed reference.

op globals

PyObject* PyFunction_GetModule(PyObject *op)
Return value: Borrowed reference.

op __module__ Python

PyObject* PyFunction_GetDefaults(PyObject *op)
Return value: Borrowed reference.

op NULL

int PyFunction_SetDefaults(PyObject *op, PyObject *defaults)

op defaults Py_None

SystemError -1

PyObject* PyFunction_GetClosure(PyObject *op)
Return value: Borrowed reference.

op NULL cell

int PyFunction_SetClosure(PyObject *op, PyObject *closure)

op closure Py_None cell

SystemError -1

PyObject *PyFunction_GetAnnotations(PyObject *op)

op NULL

int PyFunction_SetAnnotations(PyObject *op, PyObject *annotations)

op annotations Py_None

SystemError -1