1/* Former class object interface -- now only bound methods are here */
2
3/* Revealing some structures (not for general use) */
4
5#ifndef Py_LIMITED_API
6#ifndef Py_CLASSOBJECT_H
7#define Py_CLASSOBJECT_H
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12typedef struct {
13 PyObject_HEAD
14 PyObject *im_func; /* The callable object implementing the method */
15 PyObject *im_self; /* The instance it is bound to */
16 PyObject *im_weakreflist; /* List of weak references */
17} PyMethodObject;
18
19PyAPI_DATA(PyTypeObject) PyMethod_Type;
20
21#define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type)
22
23PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *);
24
25PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *);
26PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);
27
28/* Macros for direct access to these values. Type checks are *not*
29 done, so use with care. */
30#define PyMethod_GET_FUNCTION(meth) \
31 (((PyMethodObject *)meth) -> im_func)
32#define PyMethod_GET_SELF(meth) \
33 (((PyMethodObject *)meth) -> im_self)
34
35PyAPI_FUNC(int) PyMethod_ClearFreeList(void);
36
37typedef struct {
38 PyObject_HEAD
39 PyObject *func;
40} PyInstanceMethodObject;
41
42PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type;
43
44#define PyInstanceMethod_Check(op) ((op)->ob_type == &PyInstanceMethod_Type)
45
46PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *);
47PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *);
48
49/* Macros for direct access to these values. Type checks are *not*
50 done, so use with care. */
51#define PyInstanceMethod_GET_FUNCTION(meth) \
52 (((PyInstanceMethodObject *)meth) -> func)
53
54#ifdef __cplusplus
55}
56#endif
57#endif /* !Py_CLASSOBJECT_H */
58#endif /* Py_LIMITED_API */
59