2 /* Class object interface */
4 /* Revealing some structures (not for general use) */
6 #ifndef Py_CLASSOBJECT_H
7 #define Py_CLASSOBJECT_H
14 PyObject
*cl_bases
; /* A tuple of class objects */
15 PyObject
*cl_dict
; /* A dictionary */
16 PyObject
*cl_name
; /* A string */
17 /* The following three are functions or NULL */
25 PyClassObject
*in_class
; /* The class object */
26 PyObject
*in_dict
; /* A dictionary */
27 PyObject
*in_weakreflist
; /* List of weak references */
32 PyObject
*im_func
; /* The callable object implementing the method */
33 PyObject
*im_self
; /* The instance it is bound to, or NULL */
34 PyObject
*im_class
; /* The class that defined the method */
35 PyObject
*im_weakreflist
; /* List of weak references */
38 extern DL_IMPORT(PyTypeObject
) PyClass_Type
, PyInstance_Type
, PyMethod_Type
;
40 #define PyClass_Check(op) ((op)->ob_type == &PyClass_Type)
41 #define PyInstance_Check(op) ((op)->ob_type == &PyInstance_Type)
42 #define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type)
44 extern DL_IMPORT(PyObject
*) PyClass_New(PyObject
*, PyObject
*, PyObject
*);
45 extern DL_IMPORT(PyObject
*) PyInstance_New(PyObject
*, PyObject
*,
47 extern DL_IMPORT(PyObject
*) PyInstance_NewRaw(PyObject
*, PyObject
*);
48 extern DL_IMPORT(PyObject
*) PyMethod_New(PyObject
*, PyObject
*, PyObject
*);
50 extern DL_IMPORT(PyObject
*) PyMethod_Function(PyObject
*);
51 extern DL_IMPORT(PyObject
*) PyMethod_Self(PyObject
*);
52 extern DL_IMPORT(PyObject
*) PyMethod_Class(PyObject
*);
54 /* Macros for direct access to these values. Type checks are *not*
55 done, so use with care. */
56 #define PyMethod_GET_FUNCTION(meth) \
57 (((PyMethodObject *)meth) -> im_func)
58 #define PyMethod_GET_SELF(meth) \
59 (((PyMethodObject *)meth) -> im_self)
60 #define PyMethod_GET_CLASS(meth) \
61 (((PyMethodObject *)meth) -> im_class)
63 extern DL_IMPORT(int) PyClass_IsSubclass(PyObject
*, PyObject
*);
69 #endif /* !Py_CLASSOBJECT_H */