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 9 extern "C" { 10 #endif 11 12 typedef 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 vectorcallfunc vectorcall; 18 } PyMethodObject; 19 20 PyAPI_DATA(PyTypeObject) PyMethod_Type; 21 22 #define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type) 23 24 PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *); 25 26 PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *); 27 PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *); 28 29 /* Macros for direct access to these values. Type checks are *not* 30 done, so use with care. */ 31 #define PyMethod_GET_FUNCTION(meth) \ 32 (((PyMethodObject *)meth) -> im_func) 33 #define PyMethod_GET_SELF(meth) \ 34 (((PyMethodObject *)meth) -> im_self) 35 36 PyAPI_FUNC(int) PyMethod_ClearFreeList(void); 37 38 typedef struct { 39 PyObject_HEAD 40 PyObject *func; 41 } PyInstanceMethodObject; 42 43 PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type; 44 45 #define PyInstanceMethod_Check(op) ((op)->ob_type == &PyInstanceMethod_Type) 46 47 PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *); 48 PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *); 49 50 /* Macros for direct access to these values. Type checks are *not* 51 done, so use with care. */ 52 #define PyInstanceMethod_GET_FUNCTION(meth) \ 53 (((PyInstanceMethodObject *)meth) -> func) 54 55 #ifdef __cplusplus 56 } 57 #endif 58 #endif /* !Py_CLASSOBJECT_H */ 59 #endif /* Py_LIMITED_API */ 60