2 /* Function object interface */
4 #ifndef Py_FUNCOBJECT_H
5 #define Py_FUNCOBJECT_H
13 PyObject
*func_globals
;
14 PyObject
*func_defaults
;
15 PyObject
*func_closure
;
19 PyObject
*func_weakreflist
;
22 PyAPI_DATA(PyTypeObject
) PyFunction_Type
;
24 #define PyFunction_Check(op) ((op)->ob_type == &PyFunction_Type)
26 PyAPI_FUNC(PyObject
*) PyFunction_New(PyObject
*, PyObject
*);
27 PyAPI_FUNC(PyObject
*) PyFunction_GetCode(PyObject
*);
28 PyAPI_FUNC(PyObject
*) PyFunction_GetGlobals(PyObject
*);
29 PyAPI_FUNC(PyObject
*) PyFunction_GetDefaults(PyObject
*);
30 PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject
*, PyObject
*);
31 PyAPI_FUNC(PyObject
*) PyFunction_GetClosure(PyObject
*);
32 PyAPI_FUNC(int) PyFunction_SetClosure(PyObject
*, PyObject
*);
34 /* Macros for direct access to these values. Type checks are *not*
35 done, so use with care. */
36 #define PyFunction_GET_CODE(func) \
37 (((PyFunctionObject *)func) -> func_code)
38 #define PyFunction_GET_GLOBALS(func) \
39 (((PyFunctionObject *)func) -> func_globals)
40 #define PyFunction_GET_DEFAULTS(func) \
41 (((PyFunctionObject *)func) -> func_defaults)
42 #define PyFunction_GET_CLOSURE(func) \
43 (((PyFunctionObject *)func) -> func_closure)
45 /* The classmethod and staticmethod types lives here, too */
46 PyAPI_DATA(PyTypeObject
) PyClassMethod_Type
;
47 PyAPI_DATA(PyTypeObject
) PyStaticMethod_Type
;
49 PyAPI_FUNC(PyObject
*) PyClassMethod_New(PyObject
*);
50 PyAPI_FUNC(PyObject
*) PyStaticMethod_New(PyObject
*);
55 #endif /* !Py_FUNCOBJECT_H */