Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:06:40

0001 /* Former class object interface -- now only bound methods are here  */
0002 
0003 /* Revealing some structures (not for general use) */
0004 
0005 #ifndef Py_LIMITED_API
0006 #ifndef Py_CLASSOBJECT_H
0007 #define Py_CLASSOBJECT_H
0008 #ifdef __cplusplus
0009 extern "C" {
0010 #endif
0011 
0012 typedef struct {
0013     PyObject_HEAD
0014     PyObject *im_func;   /* The callable object implementing the method */
0015     PyObject *im_self;   /* The instance it is bound to */
0016     PyObject *im_weakreflist; /* List of weak references */
0017     vectorcallfunc vectorcall;
0018 } PyMethodObject;
0019 
0020 PyAPI_DATA(PyTypeObject) PyMethod_Type;
0021 
0022 #define PyMethod_Check(op) Py_IS_TYPE((op), &PyMethod_Type)
0023 
0024 PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *);
0025 
0026 PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *);
0027 PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);
0028 
0029 #define _PyMethod_CAST(meth) \
0030     (assert(PyMethod_Check(meth)), _Py_CAST(PyMethodObject*, meth))
0031 
0032 /* Static inline functions for direct access to these values.
0033    Type checks are *not* done, so use with care. */
0034 static inline PyObject* PyMethod_GET_FUNCTION(PyObject *meth) {
0035     return _PyMethod_CAST(meth)->im_func;
0036 }
0037 #define PyMethod_GET_FUNCTION(meth) PyMethod_GET_FUNCTION(_PyObject_CAST(meth))
0038 
0039 static inline PyObject* PyMethod_GET_SELF(PyObject *meth) {
0040     return _PyMethod_CAST(meth)->im_self;
0041 }
0042 #define PyMethod_GET_SELF(meth) PyMethod_GET_SELF(_PyObject_CAST(meth))
0043 
0044 typedef struct {
0045     PyObject_HEAD
0046     PyObject *func;
0047 } PyInstanceMethodObject;
0048 
0049 PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type;
0050 
0051 #define PyInstanceMethod_Check(op) Py_IS_TYPE((op), &PyInstanceMethod_Type)
0052 
0053 PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *);
0054 PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *);
0055 
0056 #define _PyInstanceMethod_CAST(meth) \
0057     (assert(PyInstanceMethod_Check(meth)), \
0058      _Py_CAST(PyInstanceMethodObject*, meth))
0059 
0060 /* Static inline function for direct access to these values.
0061    Type checks are *not* done, so use with care. */
0062 static inline PyObject* PyInstanceMethod_GET_FUNCTION(PyObject *meth) {
0063     return _PyInstanceMethod_CAST(meth)->func;
0064 }
0065 #define PyInstanceMethod_GET_FUNCTION(meth) PyInstanceMethod_GET_FUNCTION(_PyObject_CAST(meth))
0066 
0067 #ifdef __cplusplus
0068 }
0069 #endif
0070 #endif   // !Py_CLASSOBJECT_H
0071 #endif   // !Py_LIMITED_API