- Notifications
You must be signed in to change notification settings - Fork 31.7k
/
Copy pathdescrobject.h
94 lines (75 loc) · 2.42 KB
/
descrobject.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/* Descriptors */
#ifndefPy_DESCROBJECT_H
#definePy_DESCROBJECT_H
#ifdef__cplusplus
extern"C" {
#endif
typedefPyObject*(*getter)(PyObject*, void*);
typedefint (*setter)(PyObject*, PyObject*, void*);
typedefstructPyGetSetDef {
char*name;
getterget;
setterset;
char*doc;
void*closure;
} PyGetSetDef;
typedefPyObject*(*wrapperfunc)(PyObject*self, PyObject*args,
void*wrapped);
typedefPyObject*(*wrapperfunc_kwds)(PyObject*self, PyObject*args,
void*wrapped, PyObject*kwds);
structwrapperbase {
char*name;
intoffset;
void*function;
wrapperfuncwrapper;
char*doc;
intflags;
PyObject*name_strobj;
};
/* Flags for above struct */
#definePyWrapperFlag_KEYWORDS 1 /* wrapper function takes keyword args */
/* Various kinds of descriptor objects */
#definePyDescr_COMMON \
PyObject_HEAD \
PyTypeObject *d_type; \
PyObject *d_name
typedefstruct {
PyDescr_COMMON;
} PyDescrObject;
typedefstruct {
PyDescr_COMMON;
PyMethodDef*d_method;
} PyMethodDescrObject;
typedefstruct {
PyDescr_COMMON;
structPyMemberDef*d_member;
} PyMemberDescrObject;
typedefstruct {
PyDescr_COMMON;
PyGetSetDef*d_getset;
} PyGetSetDescrObject;
typedefstruct {
PyDescr_COMMON;
structwrapperbase*d_base;
void*d_wrapped; /* This can be any function pointer */
} PyWrapperDescrObject;
PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type;
PyAPI_DATA(PyTypeObject) PyDictProxy_Type;
PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type;
PyAPI_DATA(PyTypeObject) PyMemberDescr_Type;
PyAPI_FUNC(PyObject*) PyDescr_NewMethod(PyTypeObject*, PyMethodDef*);
PyAPI_FUNC(PyObject*) PyDescr_NewClassMethod(PyTypeObject*, PyMethodDef*);
PyAPI_FUNC(PyObject*) PyDescr_NewMember(PyTypeObject*,
structPyMemberDef*);
PyAPI_FUNC(PyObject*) PyDescr_NewGetSet(PyTypeObject*,
structPyGetSetDef*);
PyAPI_FUNC(PyObject*) PyDescr_NewWrapper(PyTypeObject*,
structwrapperbase*, void*);
#definePyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL)
PyAPI_FUNC(PyObject*) PyDictProxy_New(PyObject*);
PyAPI_FUNC(PyObject*) PyWrapper_New(PyObject*, PyObject*);
PyAPI_DATA(PyTypeObject) PyProperty_Type;
#ifdef__cplusplus
}
#endif
#endif/* !Py_DESCROBJECT_H */