Updated for 2.1a3
[python/dscho.git] / Include / funcobject.h
blobc8e97fdc0d6562f67294ecc0126c0130fc5dd096
2 /* Function object interface */
4 #ifndef Py_FUNCOBJECT_H
5 #define Py_FUNCOBJECT_H
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
10 typedef struct {
11 PyObject_HEAD
12 PyObject *func_code;
13 PyObject *func_globals;
14 PyObject *func_defaults;
15 PyObject *func_closure;
16 PyObject *func_doc;
17 PyObject *func_name;
18 PyObject *func_dict;
19 } PyFunctionObject;
21 extern DL_IMPORT(PyTypeObject) PyFunction_Type;
23 #define PyFunction_Check(op) ((op)->ob_type == &PyFunction_Type)
25 extern DL_IMPORT(PyObject *) PyFunction_New(PyObject *, PyObject *);
26 extern DL_IMPORT(PyObject *) PyFunction_GetCode(PyObject *);
27 extern DL_IMPORT(PyObject *) PyFunction_GetGlobals(PyObject *);
28 extern DL_IMPORT(PyObject *) PyFunction_GetDefaults(PyObject *);
29 extern DL_IMPORT(int) PyFunction_SetDefaults(PyObject *, PyObject *);
30 extern DL_IMPORT(PyObject *) PyFunction_GetClosure(PyObject *);
31 extern DL_IMPORT(int) PyFunction_SetClosure(PyObject *, PyObject *);
33 /* Macros for direct access to these values. Type checks are *not*
34 done, so use with care. */
35 #define PyFunction_GET_CODE(func) \
36 (((PyFunctionObject *)func) -> func_code)
37 #define PyFunction_GET_GLOBALS(func) \
38 (((PyFunctionObject *)func) -> func_globals)
39 #define PyFunction_GET_DEFAULTS(func) \
40 (((PyFunctionObject *)func) -> func_defaults)
41 #define PyFunction_GET_CLOSURE(func) \
42 (((PyFunctionObject *)func) -> func_closure)
44 #ifdef __cplusplus
46 #endif
47 #endif /* !Py_FUNCOBJECT_H */