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) Py_IS_TYPE(op, &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 typedef struct { 37 PyObject_HEAD 38 PyObject *func; 39 } PyInstanceMethodObject; 40 41 PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type; 42 43 #define PyInstanceMethod_Check(op) Py_IS_TYPE(op, &PyInstanceMethod_Type) 44 45 PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *); 46 PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *); 47 48 /* Macros for direct access to these values. Type checks are *not* 49 done, so use with care. */ 50 #define PyInstanceMethod_GET_FUNCTION(meth) \ 51 (((PyInstanceMethodObject *)meth) -> func) 52 53 #ifdef __cplusplus 54 } 55 #endif 56 #endif /* !Py_CLASSOBJECT_H */ 57 #endif /* Py_LIMITED_API */ 58