1
-
2
- /* Class object interface */
1
+ /* Former class object interface -- now only (un)bound methods are here */
3
2
4
3
/* Revealing some structures (not for general use) */
5
4
9
8
extern "C" {
10
9
#endif
11
10
12
- typedef struct {
13
- PyObject_HEAD
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 */
18
- PyObject * cl_getattr ;
19
- PyObject * cl_setattr ;
20
- PyObject * cl_delattr ;
21
- } PyClassObject ;
22
-
23
- typedef struct {
24
- PyObject_HEAD
25
- PyClassObject * in_class ; /* The class object */
26
- PyObject * in_dict ; /* A dictionary */
27
- PyObject * in_weakreflist ; /* List of weak references */
28
- } PyInstanceObject ;
29
-
30
11
typedef struct {
31
12
PyObject_HEAD
32
13
PyObject * im_func ; /* The callable object implementing the method */
@@ -35,34 +16,16 @@ typedef struct {
35
16
PyObject * im_weakreflist ; /* List of weak references */
36
17
} PyMethodObject ;
37
18
38
- PyAPI_DATA (PyTypeObject ) PyClass_Type , PyInstance_Type , PyMethod_Type ;
19
+ PyAPI_DATA (PyTypeObject ) PyMethod_Type ;
39
20
40
- #define PyClass_Check (op ) ((op)->ob_type == &PyClass_Type)
41
- #define PyInstance_Check (op ) ((op)->ob_type == &PyInstance_Type)
42
21
#define PyMethod_Check (op ) ((op)->ob_type == &PyMethod_Type)
43
22
44
- PyAPI_FUNC (PyObject * ) PyClass_New (PyObject * , PyObject * , PyObject * );
45
- PyAPI_FUNC (PyObject * ) PyInstance_New (PyObject * , PyObject * ,
46
- PyObject * );
47
- PyAPI_FUNC (PyObject * ) PyInstance_NewRaw (PyObject * , PyObject * );
48
23
PyAPI_FUNC (PyObject * ) PyMethod_New (PyObject * , PyObject * , PyObject * );
49
24
50
25
PyAPI_FUNC (PyObject * ) PyMethod_Function (PyObject * );
51
26
PyAPI_FUNC (PyObject * ) PyMethod_Self (PyObject * );
52
27
PyAPI_FUNC (PyObject * ) PyMethod_Class (PyObject * );
53
28
54
- /* Look up attribute with name (a string) on instance object pinst, using
55
- * only the instance and base class dicts. If a descriptor is found in
56
- * a class dict, the descriptor is returned without calling it.
57
- * Returns NULL if nothing found, else a borrowed reference to the
58
- * value associated with name in the dict in which name was found.
59
- * The point of this routine is that it never calls arbitrary Python
60
- * code, so is always "safe": all it does is dict lookups. The function
61
- * can't fail, never sets an exception, and NULL is not an error (it just
62
- * means "not found").
63
- */
64
- PyAPI_FUNC (PyObject * ) _PyInstance_Lookup (PyObject * pinst , PyObject * name );
65
-
66
29
/* Macros for direct access to these values. Type checks are *not*
67
30
done, so use with care. */
68
31
#define PyMethod_GET_FUNCTION (meth ) \
@@ -72,9 +35,6 @@ PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name);
72
35
#define PyMethod_GET_CLASS (meth ) \
73
36
(((PyMethodObject *)meth) -> im_class)
74
37
75
- PyAPI_FUNC (int ) PyClass_IsSubclass (PyObject * , PyObject * );
76
-
77
-
78
38
#ifdef __cplusplus
79
39
}
80
40
#endif
0 commit comments