-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrpmdebug-py.c
108 lines (96 loc) · 3.7 KB
/
rpmdebug-py.c
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*@unchecked@*/
extern PyTypeObject PyCode_Type;
/*@unchecked@*/
extern PyTypeObject PyDictIter_Type;
/*@unchecked@*/
extern PyTypeObject PyFrame_Type;
#include <rpmcli.h> /* XXX debug only */
#include "header-py.h" /* XXX debug only */
#include "rpmal-py.h" /* XXX debug only */
#include "rpmds-py.h" /* XXX debug only */
#include "rpmfd-py.h" /* XXX debug only */
#include "rpmfi-py.h" /* XXX debug only */
#include "rpmfts-py.h" /* XXX debug only */
#include "rpmmi-py.h" /* XXX debug only */
#include "rpmps-py.h" /* XXX debug only */
#include "rpmte-py.h" /* XXX debug only */
#include "rpmts-py.h" /* XXX debug only */
/**
*/
/*@observer@*/
static inline const char * lbl(void * s)
/*@*/
{
PyObject * o = s;
if (o == NULL) return "null";
if (o == Py_None) return "None";
if (o->ob_type == &PyType_Type) return o->ob_type->tp_name;
if (o->ob_type == &PyBaseObject_Type) return "BaseObj";
#if PY_MAJOR_VERSION == 2
if (o->ob_type == &PyBuffer_Type) return "Buffer";
#endif
if (o->ob_type == &PyCFunction_Type) return "CFunction";
#if PY_MAJOR_VERSION >= 3
if (o->ob_type == &PyCapsule_Type) return "Capsule";
#else
if (o->ob_type == &PyCObject_Type) return "CObject";
#endif
if (o->ob_type == &PyCell_Type) return "Cell";
#if PY_MAJOR_VERSION == 2
if (o->ob_type == &PyClass_Type) return "Class";
#endif
if (o->ob_type == &PyClassMethod_Type) return "ClassMethod";
if (o->ob_type == &PyStaticMethod_Type) return "StaticMethod";
if (o->ob_type == &PyCode_Type) return "Code";
if (o->ob_type == &PyComplex_Type) return "Complex";
if (o->ob_type == &PyDict_Type) return "Dict";
#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 4
if (o->ob_type == &PyDictIter_Type) return "DictIter";
#endif
#if PY_MAJOR_VERSION == 2
if (o->ob_type == &PyFile_Type) return "File";
#endif
if (o->ob_type == &PyFloat_Type) return "Float";
if (o->ob_type == &PyFrame_Type) return "Frame";
if (o->ob_type == &PyFunction_Type) return "Function";
#if PY_MAJOR_VERSION >= 3
if (o->ob_type == &PyInstanceMethod_Type) return "InstanceMethod";
#else
if (o->ob_type == &PyInstance_Type) return "Instance";
#endif
#if PY_MAJOR_VERSION >= 3
if (o->ob_type == &PyLong_Type) return "Long";
#else
if (o->ob_type == &PyInt_Type) return "Int";
#endif
if (o->ob_type == &PyList_Type) return "List";
if (o->ob_type == &PyLong_Type) return "Long";
if (o->ob_type == &PyMethod_Type) return "Method";
if (o->ob_type == &PyWrapperDescr_Type) return "WrapperDescr";
if (o->ob_type == &PyProperty_Type) return "Property";
if (o->ob_type == &PyModule_Type) return "Module";
if (o->ob_type == &PyRange_Type) return "Range";
if (o->ob_type == &PySeqIter_Type) return "SeqIter";
if (o->ob_type == &PyCallIter_Type) return "CallIter";
if (o->ob_type == &PySlice_Type) return "Slice";
#if PY_MAJOR_VERSION >= 3
if (o->ob_type == &PyBytes_Type) return "Bytes";
#else
if (o->ob_type == &PyString_Type) return "String";
#endif
if (o->ob_type == &PySuper_Type) return "Super";
if (o->ob_type == &PyTuple_Type) return "Tuple";
if (o->ob_type == &PyType_Type) return "Type";
if (o->ob_type == &PyUnicode_Type) return "Unicode";
if (o->ob_type == &hdr_Type) return "hdr";
if (o->ob_type == &rpmal_Type) return "rpmal";
if (o->ob_type == &rpmds_Type) return "rpmds";
if (o->ob_type == &rpmfd_Type) return "rpmfd";
if (o->ob_type == &rpmfi_Type) return "rpmfi";
if (o->ob_type == &rpmfts_Type) return "rpmfts";
if (o->ob_type == &rpmmi_Type) return "rpmmi";
if (o->ob_type == &rpmProblem_Type) return "rpmProblem";
if (o->ob_type == &rpmte_Type) return "rpmte";
if (o->ob_type == &rpmts_Type) return "rpmts";
return "Unknown";
}