]> git.pld-linux.org Git - packages/sip.git/blob - sip-python2.5.patch
- up to 4.7.3
[packages/sip.git] / sip-python2.5.patch
1 diff -ur sip-4.4.5/siplib/objmap.c sip-4.4.5.phh/siplib/objmap.c
2 --- sip-4.4.5/siplib/objmap.c   2006-06-10 13:36:40.000000000 +0200
3 +++ sip-4.4.5/siplib/objmap.c   2006-07-14 17:21:18.053987000 +0200
4 @@ -114,8 +114,8 @@
5                  * of it, or vice versa, then we assume it is the same C++
6                  * object.
7                  */
8 -               if (PyObject_TypeCheck(w,&type -> super.type) ||
9 -                   PyType_IsSubtype(&type -> super.type,w -> ob_type))
10 +               if (PyObject_TypeCheck(w,&type -> super.ht_type) ||
11 +                   PyType_IsSubtype(&type -> super.ht_type,w -> ob_type))
12                         return w;
13         }
14  
15 diff -ur sip-4.4.5/siplib/sip.h sip-4.4.5.phh/siplib/sip.h
16 --- sip-4.4.5/siplib/sip.h      2006-06-10 13:36:41.000000000 +0200
17 +++ sip-4.4.5/siplib/sip.h      2006-07-15 11:12:32.928487750 +0200
18 @@ -873,6 +873,12 @@
19  #define        sipTypeIsAbstract(wt)   ((wt)->type->td_flags & SIP_TYPE_ABSTRACT)
20  #define        sipTypeHasSCC(wt)       ((wt)->type->td_flags & SIP_TYPE_SCC)
21  
22 +//Hack to build against python 2.5
23 +#if PY_MAJOR_VERSION==2 && PY_MINOR_VERSION <= 4
24 +#define ht_type type
25 +#define ht_name name
26 +#endif
27 +
28  
29  #ifdef __cplusplus
30  }
31 diff -ur sip-4.4.5/siplib/siplib.c sip-4.4.5.phh/siplib/siplib.c
32 --- sip-4.4.5/siplib/siplib.c   2006-06-10 13:36:40.000000000 +0200
33 +++ sip-4.4.5/siplib/siplib.c   2006-07-14 17:20:48.400133750 +0200
34 @@ -396,7 +396,7 @@
35         if (PyType_Ready(&sipWrapperType_Type) < 0)
36                 Py_FatalError("sip: Failed to initialise sip.wrappertype type");
37  
38 -       if (PyType_Ready(&sipWrapper_Type.super.type) < 0)
39 +       if (PyType_Ready(&sipWrapper_Type.super.ht_type) < 0)
40                 Py_FatalError("sip: Failed to initialise sip.wrapper type");
41  
42         if (PyType_Ready(&sipVoidPtr_Type) < 0)
43 @@ -830,7 +830,7 @@
44                 {
45                         sipWrapperType *wt;
46  
47 -                       if ((wt = *mw++) != NULL && addInstances(wt->super.type.tp_dict, &wt->type->td_instances) < 0)
48 +                       if ((wt = *mw++) != NULL && addInstances(wt->super.ht_type.tp_dict, &wt->type->td_instances) < 0)
49                                 return -1;
50                 }
51  
52 @@ -3181,7 +3181,7 @@
53         if (type->td_scope.sc_flag)
54                 dict = mod_dict;
55         else
56 -               dict = getClassType(&type->td_scope, client)->super.type.tp_dict;
57 +               dict = getClassType(&type->td_scope, client)->super.ht_type.tp_dict;
58  
59         /* Add the type to the "parent" dictionary. */
60         if (PyDict_SetItem(dict,name,(PyObject *)wt) < 0)
61 @@ -3231,7 +3231,7 @@
62         if (ed->e_scope < 0)
63                 dict = mod_dict;
64         else
65 -               dict = client->em_types[ed->e_scope]->super.type.tp_dict;
66 +               dict = client->em_types[ed->e_scope]->super.ht_type.tp_dict;
67  
68         /* Create the base type tuple if it hasn't already been done. */
69         if (bases == NULL && (bases = Py_BuildValue("(O)",&PyInt_Type)) == NULL)
70 @@ -3417,7 +3417,7 @@
71  
72         self = PyTuple_GET_ITEM(args,argnr);
73  
74 -       if (!PyObject_TypeCheck(self,&type -> super.type))
75 +       if (!PyObject_TypeCheck(self,&type -> super.ht_type))
76                 return PARSE_UNBOUND;
77  
78         *selfp = (sipWrapper *)self;
79 @@ -4288,7 +4288,7 @@
80  {
81         /* If this is a wrapped type then get the type dictionary. */
82         if (sipWrapperType_Check(dict))
83 -               dict = ((sipWrapperType *)dict)->super.type.tp_dict;
84 +               dict = ((sipWrapperType *)dict)->super.ht_type.tp_dict;
85  
86         return addSingleEnumInstance(dict, name, value, type);
87  }
88 @@ -4338,7 +4338,7 @@
89  {
90         /* If this is a wrapped type then get the type dictionary. */
91         if (sipWrapperType_Check(dict))
92 -               dict = ((sipWrapperType *)dict) -> super.type.tp_dict;
93 +               dict = ((sipWrapperType *)dict) -> super.ht_type.tp_dict;
94  
95         return addSingleClassInstance(dict,name,cppPtr,wt,0);
96  }
97 @@ -4355,7 +4355,7 @@
98  
99         /* If this is a wrapped type then get the type dictionary. */
100         if (sipWrapperType_Check(dict))
101 -               dict = ((sipWrapperType *)dict)->super.type.tp_dict;
102 +               dict = ((sipWrapperType *)dict)->super.ht_type.tp_dict;
103  
104         if ((w = mt->mt_cfrom(cppPtr, NULL)) == NULL)
105                 return -1;
106 @@ -4534,7 +4534,7 @@
107         if (pyObj == Py_None)
108                 ok = ((flags & SIP_NOT_NONE) == 0);
109         else if (cto == NULL || (flags & SIP_NO_CONVERTORS) != 0)
110 -               ok = PyObject_TypeCheck(pyObj, &type->super.type);
111 +               ok = PyObject_TypeCheck(pyObj, &type->super.ht_type);
112         else
113                 ok = cto(pyObj, NULL, NULL, NULL);
114  
115 @@ -4954,7 +4954,7 @@
116                          * convertor might be able to convert the target type
117                          * to something more specific.
118                          */
119 -                       if (PyType_IsSubtype(&type -> super.type,&scc -> scc_basetype -> super.type))
120 +                       if (PyType_IsSubtype(&type -> super.ht_type,&scc -> scc_basetype -> super.ht_type))
121                         {
122                                 sipWrapperType *subtype;
123  
124 @@ -5508,7 +5508,7 @@
125          * We check by comparing the actual type name with the name used to
126          * create the original wrapped type.
127          */
128 -       if ((name = PyString_AsString(wt->super.name)) == NULL)
129 +       if ((name = PyString_AsString(wt->super.ht_name)) == NULL)
130                 return FALSE;
131  
132         return (strcmp(name, getBaseName(wt->type->td_name)) == 0);
133 @@ -5564,7 +5564,7 @@
134          */
135         if (self -> type == NULL)
136         {
137 -               PyObject *sc = (PyObject *)self->super.type.tp_base;
138 +               PyObject *sc = (PyObject *)self->super.ht_type.tp_base;
139  
140                 /*
141                  * Make sure that the type is derived from sip.wrapper.  It
142 @@ -5573,7 +5573,7 @@
143                  */
144                 if (sc == NULL || !sipWrapperType_Check(sc))
145                 {
146 -                       PyErr_Format(PyExc_TypeError, "type %s must be derived from sip.wrapper", self->super.type.tp_name);
147 +                       PyErr_Format(PyExc_TypeError, "type %s must be derived from sip.wrapper", self->super.ht_type.tp_name);
148                         return -1;
149                 }
150  
151 @@ -5608,7 +5608,7 @@
152                 PyObject *dict;
153                 PyMethodDef *pmd;
154  
155 -               dict = wt -> super.type.tp_dict;
156 +               dict = wt -> super.ht_type.tp_dict;
157  
158                 /* The base type doesn't have any type information. */
159                 if ((td = wt->type) == NULL || !isExactWrappedType(wt))
160 @@ -5826,7 +5826,7 @@
161                 }
162  
163                 /* See if it is an abstract type. */
164 -               if (sipTypeIsAbstract(wt) && strcmp(strchr(wt->type->td_name, '.') + 1, wt->super.type.tp_name) == 0)
165 +               if (sipTypeIsAbstract(wt) && strcmp(strchr(wt->type->td_name, '.') + 1, wt->super.ht_type.tp_name) == 0)
166                 {
167                         PyErr_Format(PyExc_TypeError, "%s represents a C++ abstract class and cannot be instantiated", wt->type->td_name);
168  
169 @@ -5835,7 +5835,7 @@
170         }
171  
172         /* Call the standard super-type new. */
173 -       return PyBaseObject_Type.tp_new(&wt -> super.type,args,kwds);
174 +       return PyBaseObject_Type.tp_new(&wt -> super.ht_type,args,kwds);
175  }
176  
177  
178 @@ -6402,7 +6402,7 @@
179  
180         /* Add the slots for this type. */
181         if (td -> td_pyslots != NULL)
182 -               initSlots(&wt->super.type, &wt->super.as_number, &wt->super.as_sequence, &wt->super.as_mapping, td->td_pyslots, FALSE);
183 +               initSlots(&wt->super.ht_type, &wt->super.as_number, &wt->super.as_sequence, &wt->super.as_mapping, td->td_pyslots, FALSE);
184  
185         /* Recurse through any super-types. */
186         if ((sup = td -> td_supers) != NULL)
This page took 0.10326 seconds and 3 git commands to generate.