2007-11-27 10:40:20 +00:00
|
|
|
/* Former class object interface -- now only bound methods are here */
|
1990-10-14 12:07:46 +00:00
|
|
|
|
1993-05-21 19:56:10 +00:00
|
|
|
/* Revealing some structures (not for general use) */
|
1990-10-14 12:07:46 +00:00
|
|
|
|
2010-12-03 20:14:31 +00:00
|
|
|
#ifndef Py_LIMITED_API
|
2000-07-09 00:20:36 +00:00
|
|
|
#ifndef Py_CLASSOBJECT_H
|
|
|
|
|
#define Py_CLASSOBJECT_H
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
1998-07-10 15:46:33 +00:00
|
|
|
typedef struct {
|
2000-07-09 00:20:36 +00:00
|
|
|
PyObject_HEAD
|
|
|
|
|
PyObject *im_func; /* The callable object implementing the method */
|
2007-11-27 10:40:20 +00:00
|
|
|
PyObject *im_self; /* The instance it is bound to */
|
2001-03-23 04:17:58 +00:00
|
|
|
PyObject *im_weakreflist; /* List of weak references */
|
2019-05-29 20:31:52 +02:00
|
|
|
vectorcallfunc vectorcall;
|
1998-07-10 15:46:33 +00:00
|
|
|
} PyMethodObject;
|
|
|
|
|
|
2006-08-17 05:42:55 +00:00
|
|
|
PyAPI_DATA(PyTypeObject) PyMethod_Type;
|
1990-10-14 12:07:46 +00:00
|
|
|
|
2022-06-16 13:49:43 +02:00
|
|
|
#define PyMethod_Check(op) Py_IS_TYPE((op), &PyMethod_Type)
|
1990-10-14 12:07:46 +00:00
|
|
|
|
2007-11-27 10:40:20 +00:00
|
|
|
PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *);
|
1990-10-14 12:07:46 +00:00
|
|
|
|
2002-08-12 07:21:58 +00:00
|
|
|
PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *);
|
|
|
|
|
PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);
|
2001-09-05 22:52:50 +00:00
|
|
|
|
2022-11-28 16:40:08 +01:00
|
|
|
#define _PyMethod_CAST(meth) \
|
|
|
|
|
(assert(PyMethod_Check(meth)), _Py_CAST(PyMethodObject*, meth))
|
|
|
|
|
|
|
|
|
|
/* Static inline functions for direct access to these values.
|
|
|
|
|
Type checks are *not* done, so use with care. */
|
|
|
|
|
static inline PyObject* PyMethod_GET_FUNCTION(PyObject *meth) {
|
|
|
|
|
return _PyMethod_CAST(meth)->im_func;
|
|
|
|
|
}
|
|
|
|
|
#define PyMethod_GET_FUNCTION(meth) PyMethod_GET_FUNCTION(_PyObject_CAST(meth))
|
|
|
|
|
|
|
|
|
|
static inline PyObject* PyMethod_GET_SELF(PyObject *meth) {
|
|
|
|
|
return _PyMethod_CAST(meth)->im_self;
|
|
|
|
|
}
|
|
|
|
|
#define PyMethod_GET_SELF(meth) PyMethod_GET_SELF(_PyObject_CAST(meth))
|
1998-07-10 15:46:33 +00:00
|
|
|
|
2007-12-11 19:56:40 +00:00
|
|
|
typedef struct {
|
2017-11-28 17:56:10 +02:00
|
|
|
PyObject_HEAD
|
|
|
|
|
PyObject *func;
|
2007-12-11 19:56:40 +00:00
|
|
|
} PyInstanceMethodObject;
|
|
|
|
|
|
|
|
|
|
PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type;
|
|
|
|
|
|
2022-06-16 13:49:43 +02:00
|
|
|
#define PyInstanceMethod_Check(op) Py_IS_TYPE((op), &PyInstanceMethod_Type)
|
2007-12-11 19:56:40 +00:00
|
|
|
|
|
|
|
|
PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *);
|
|
|
|
|
PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *);
|
|
|
|
|
|
2022-11-28 16:40:08 +01:00
|
|
|
#define _PyInstanceMethod_CAST(meth) \
|
|
|
|
|
(assert(PyInstanceMethod_Check(meth)), \
|
|
|
|
|
_Py_CAST(PyInstanceMethodObject*, meth))
|
|
|
|
|
|
|
|
|
|
/* Static inline function for direct access to these values.
|
|
|
|
|
Type checks are *not* done, so use with care. */
|
|
|
|
|
static inline PyObject* PyInstanceMethod_GET_FUNCTION(PyObject *meth) {
|
|
|
|
|
return _PyInstanceMethod_CAST(meth)->func;
|
|
|
|
|
}
|
|
|
|
|
#define PyInstanceMethod_GET_FUNCTION(meth) PyInstanceMethod_GET_FUNCTION(_PyObject_CAST(meth))
|
2007-12-11 19:56:40 +00:00
|
|
|
|
1993-07-28 09:05:47 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2021-10-15 09:46:29 +02:00
|
|
|
#endif // !Py_CLASSOBJECT_H
|
|
|
|
|
#endif // !Py_LIMITED_API
|