--- /dev/null
+\r
+/* Function object interface */\r
+\r
+#ifndef Py_FUNCOBJECT_H\r
+#define Py_FUNCOBJECT_H\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+/* Function objects and code objects should not be confused with each other:\r
+ *\r
+ * Function objects are created by the execution of the 'def' statement.\r
+ * They reference a code object in their func_code attribute, which is a\r
+ * purely syntactic object, i.e. nothing more than a compiled version of some\r
+ * source code lines. There is one code object per source code "fragment",\r
+ * but each code object can be referenced by zero or many function objects\r
+ * depending only on how many times the 'def' statement in the source was\r
+ * executed so far.\r
+ */\r
+\r
+typedef struct {\r
+ PyObject_HEAD\r
+ PyObject *func_code; /* A code object */\r
+ PyObject *func_globals; /* A dictionary (other mappings won't do) */\r
+ PyObject *func_defaults; /* NULL or a tuple */\r
+ PyObject *func_closure; /* NULL or a tuple of cell objects */\r
+ PyObject *func_doc; /* The __doc__ attribute, can be anything */\r
+ PyObject *func_name; /* The __name__ attribute, a string object */\r
+ PyObject *func_dict; /* The __dict__ attribute, a dict or NULL */\r
+ PyObject *func_weakreflist; /* List of weak references */\r
+ PyObject *func_module; /* The __module__ attribute, can be anything */\r
+\r
+ /* Invariant:\r
+ * func_closure contains the bindings for func_code->co_freevars, so\r
+ * PyTuple_Size(func_closure) == PyCode_GetNumFree(func_code)\r
+ * (func_closure may be NULL if PyCode_GetNumFree(func_code) == 0).\r
+ */\r
+} PyFunctionObject;\r
+\r
+PyAPI_DATA(PyTypeObject) PyFunction_Type;\r
+\r
+#define PyFunction_Check(op) (Py_TYPE(op) == &PyFunction_Type)\r
+\r
+PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *);\r
+PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *);\r
+PyAPI_FUNC(PyObject *) PyFunction_GetGlobals(PyObject *);\r
+PyAPI_FUNC(PyObject *) PyFunction_GetModule(PyObject *);\r
+PyAPI_FUNC(PyObject *) PyFunction_GetDefaults(PyObject *);\r
+PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject *, PyObject *);\r
+PyAPI_FUNC(PyObject *) PyFunction_GetClosure(PyObject *);\r
+PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *);\r
+\r
+/* Macros for direct access to these values. Type checks are *not*\r
+ done, so use with care. */\r
+#define PyFunction_GET_CODE(func) \\r
+ (((PyFunctionObject *)func) -> func_code)\r
+#define PyFunction_GET_GLOBALS(func) \\r
+ (((PyFunctionObject *)func) -> func_globals)\r
+#define PyFunction_GET_MODULE(func) \\r
+ (((PyFunctionObject *)func) -> func_module)\r
+#define PyFunction_GET_DEFAULTS(func) \\r
+ (((PyFunctionObject *)func) -> func_defaults)\r
+#define PyFunction_GET_CLOSURE(func) \\r
+ (((PyFunctionObject *)func) -> func_closure)\r
+\r
+/* The classmethod and staticmethod types lives here, too */\r
+PyAPI_DATA(PyTypeObject) PyClassMethod_Type;\r
+PyAPI_DATA(PyTypeObject) PyStaticMethod_Type;\r
+\r
+PyAPI_FUNC(PyObject *) PyClassMethod_New(PyObject *);\r
+PyAPI_FUNC(PyObject *) PyStaticMethod_New(PyObject *);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+#endif /* !Py_FUNCOBJECT_H */\r