2 /* Method object interface */
4 #ifndef Py_METHODOBJECT_H
5 #define Py_METHODOBJECT_H
10 PyAPI_DATA(PyTypeObject
) PyCFunction_Type
;
12 #define PyCFunction_Check(op) ((op)->ob_type == &PyCFunction_Type)
14 typedef PyObject
*(*PyCFunction
)(PyObject
*, PyObject
*);
15 typedef PyObject
*(*PyCFunctionWithKeywords
)(PyObject
*, PyObject
*,
17 typedef PyObject
*(*PyNoArgsFunction
)(PyObject
*);
19 PyAPI_FUNC(PyCFunction
) PyCFunction_GetFunction(PyObject
*);
20 PyAPI_FUNC(PyObject
*) PyCFunction_GetSelf(PyObject
*);
21 PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject
*);
23 /* Macros for direct access to these values. Type checks are *not*
24 done, so use with care. */
25 #define PyCFunction_GET_FUNCTION(func) \
26 (((PyCFunctionObject *)func) -> m_ml -> ml_meth)
27 #define PyCFunction_GET_SELF(func) \
28 (((PyCFunctionObject *)func) -> m_self)
29 #define PyCFunction_GET_FLAGS(func) \
30 (((PyCFunctionObject *)func) -> m_ml -> ml_flags)
31 PyAPI_FUNC(PyObject
*) PyCFunction_Call(PyObject
*, PyObject
*, PyObject
*);
39 typedef struct PyMethodDef PyMethodDef
;
41 PyAPI_FUNC(PyObject
*) Py_FindMethod(PyMethodDef
[], PyObject
*, char *);
43 PyAPI_FUNC(PyObject
*) PyCFunction_New(PyMethodDef
*, PyObject
*);
45 /* Flag passed to newmethodobject */
46 #define METH_OLDARGS 0x0000
47 #define METH_VARARGS 0x0001
48 #define METH_KEYWORDS 0x0002
49 /* METH_NOARGS and METH_O must not be combined with the flags above. */
50 #define METH_NOARGS 0x0004
53 /* METH_CLASS and METH_STATIC are a little different; these control
54 the construction of methods for a class. These cannot be used for
55 functions in modules. */
56 #define METH_CLASS 0x0010
57 #define METH_STATIC 0x0020
59 typedef struct PyMethodChain
{
60 PyMethodDef
*methods
; /* Methods of this type */
61 struct PyMethodChain
*link
; /* NULL or base type */
64 PyAPI_FUNC(PyObject
*) Py_FindMethodInChain(PyMethodChain
*, PyObject
*,
76 #endif /* !Py_METHODOBJECT_H */