[PyKDE] SIP: Python 2.5 patch
Giovanni Bajo
rasky at develer.com
Fri Jul 14 02:01:57 BST 2006
Hello,
this patch is necessary to compile SIP 4.4.3 with Python 2.5b2. See also:
http://svn.python.org/view/python/trunk/Include/object.h?rev=42531&r1=42410&r2=42531
http://sourceforge.net/tracker/index.php?func=detail&aid=1086854&group_id=5470&atid=105470
Not sure how you're going to integrate this and save backward compatibility.
Giovanni Bajo
-------------- next part --------------
Index: branches/py25/lib/sip/siplib/siplib.c
===================================================================
--- branches/py25/lib/sip/siplib/siplib.c (revision 6441)
+++ branches/py25/lib/sip/siplib/siplib.c (revision 6442)
@@ -377,7 +377,7 @@
if (PyType_Ready(&sipWrapperType_Type) < 0)
Py_FatalError("sip: Failed to initialise sip.wrappertype type");
- if (PyType_Ready(&sipWrapper_Type.super.type) < 0)
+ if (PyType_Ready(&sipWrapper_Type.super.ht_type) < 0)
Py_FatalError("sip: Failed to initialise sip.wrapper type");
if (PyType_Ready(&sipVoidPtr_Type) < 0)
@@ -811,7 +811,7 @@
{
sipWrapperType *wt;
- if ((wt = *mw++) != NULL && addInstances(wt->super.type.tp_dict, &wt->type->td_instances) < 0)
+ if ((wt = *mw++) != NULL && addInstances(wt->super.ht_type.tp_dict, &wt->type->td_instances) < 0)
return -1;
}
@@ -3165,7 +3165,7 @@
if (type->td_scope.sc_flag)
dict = mod_dict;
else
- dict = getClassType(&type->td_scope, client)->super.type.tp_dict;
+ dict = getClassType(&type->td_scope, client)->super.ht_type.tp_dict;
/* Add the type to the "parent" dictionary. */
if (PyDict_SetItem(dict,name,(PyObject *)wt) < 0)
@@ -3215,7 +3215,7 @@
if (ed->e_scope < 0)
dict = mod_dict;
else
- dict = client->em_types[ed->e_scope]->super.type.tp_dict;
+ dict = client->em_types[ed->e_scope]->super.ht_type.tp_dict;
/* Create the base type tuple if it hasn't already been done. */
if (bases == NULL && (bases = Py_BuildValue("(O)",&PyInt_Type)) == NULL)
@@ -3401,7 +3401,7 @@
self = PyTuple_GET_ITEM(args,argnr);
- if (!PyObject_TypeCheck(self,&type -> super.type))
+ if (!PyObject_TypeCheck(self,&type -> super.ht_type))
return PARSE_UNBOUND;
*selfp = (sipWrapper *)self;
@@ -4273,7 +4273,7 @@
{
/* If this is a wrapped type then get the type dictionary. */
if (sipWrapperType_Check(dict))
- dict = ((sipWrapperType *)dict)->super.type.tp_dict;
+ dict = ((sipWrapperType *)dict)->super.ht_type.tp_dict;
return addSingleEnumInstance(dict, name, value, type);
}
@@ -4323,7 +4323,7 @@
{
/* If this is a wrapped type then get the type dictionary. */
if (sipWrapperType_Check(dict))
- dict = ((sipWrapperType *)dict) -> super.type.tp_dict;
+ dict = ((sipWrapperType *)dict) -> super.ht_type.tp_dict;
return addSingleClassInstance(dict,name,cppPtr,wt,0);
}
@@ -4340,7 +4340,7 @@
/* If this is a wrapped type then get the type dictionary. */
if (sipWrapperType_Check(dict))
- dict = ((sipWrapperType *)dict)->super.type.tp_dict;
+ dict = ((sipWrapperType *)dict)->super.ht_type.tp_dict;
if ((w = mt->mt_cfrom(cppPtr, NULL)) == NULL)
return -1;
@@ -4521,7 +4521,7 @@
if (pyObj == Py_None)
ok = ((flags & SIP_NOT_NONE) == 0);
else if (cto == NULL || (flags & SIP_NO_CONVERTORS) != 0)
- ok = PyObject_TypeCheck(pyObj, &type->super.type);
+ ok = PyObject_TypeCheck(pyObj, &type->super.ht_type);
else
ok = cto(pyObj, NULL, NULL, NULL);
@@ -4941,7 +4941,7 @@
* convertor might be able to convert the target type
* to something more specific.
*/
- if (PyType_IsSubtype(&type -> super.type,&scc -> scc_basetype -> super.type))
+ if (PyType_IsSubtype(&type -> super.ht_type,&scc -> scc_basetype -> super.ht_type))
{
sipWrapperType *subtype;
@@ -5495,7 +5495,7 @@
* We check by comparing the actual type name with the name used to
* create the original wrapped type.
*/
- if ((name = PyString_AsString(wt->super.name)) == NULL)
+ if ((name = PyString_AsString(wt->super.ht_name)) == NULL)
return FALSE;
return (strcmp(name, getBaseName(wt->type->td_name)) == 0);
@@ -5551,7 +5551,7 @@
*/
if (self -> type == NULL)
{
- PyObject *sc = self->super.type.tp_base;
+ PyObject *sc = self->super.ht_type.tp_base;
/*
* Make sure that the type is derived from sip.wrapper. It
@@ -5560,7 +5560,7 @@
*/
if (sc == NULL || !sipWrapperType_Check(sc))
{
- PyErr_Format(PyExc_TypeError, "type %s must be derived from sip.wrapper", self->super.type.tp_name);
+ PyErr_Format(PyExc_TypeError, "type %s must be derived from sip.wrapper", self->super.ht_type.tp_name);
return -1;
}
@@ -5595,7 +5595,7 @@
PyObject *dict;
PyMethodDef *pmd;
- dict = wt -> super.type.tp_dict;
+ dict = wt -> super.ht_type.tp_dict;
/* The base type doesn't have any type information. */
if ((td = wt->type) == NULL || !isExactWrappedType(wt))
@@ -5813,7 +5813,7 @@
}
/* See if it is an abstract type. */
- if (sipTypeIsAbstract(wt) && strcmp(strchr(wt->type->td_name, '.') + 1, wt->super.type.tp_name) == 0)
+ if (sipTypeIsAbstract(wt) && strcmp(strchr(wt->type->td_name, '.') + 1, wt->super.ht_type.tp_name) == 0)
{
PyErr_Format(PyExc_TypeError, "%s represents a C++ abstract class and cannot be instantiated", wt->type->td_name);
@@ -5822,7 +5822,7 @@
}
/* Call the standard super-type new. */
- return PyBaseObject_Type.tp_new(&wt -> super.type,args,kwds);
+ return PyBaseObject_Type.tp_new(&wt -> super.ht_type,args,kwds);
}
@@ -6389,7 +6389,7 @@
/* Add the slots for this type. */
if (td -> td_pyslots != NULL)
- initSlots(&wt->super.type, &wt->super.as_number, &wt->super.as_sequence, &wt->super.as_mapping, td->td_pyslots, FALSE);
+ initSlots(&wt->super.ht_type, &wt->super.as_number, &wt->super.as_sequence, &wt->super.as_mapping, td->td_pyslots, FALSE);
/* Recurse through any super-types. */
if ((sup = td -> td_supers) != NULL)
Index: branches/py25/lib/sip/siplib/objmap.c
===================================================================
--- branches/py25/lib/sip/siplib/objmap.c (revision 6441)
+++ branches/py25/lib/sip/siplib/objmap.c (revision 6442)
@@ -114,8 +114,8 @@
* of it, or vice versa, then we assume it is the same C++
* object.
*/
- if (PyObject_TypeCheck(w,&type -> super.type) ||
- PyType_IsSubtype(&type -> super.type,w -> ob_type))
+ if (PyObject_TypeCheck(w,&type -> super.ht_type) ||
+ PyType_IsSubtype(&type -> super.ht_type,w -> ob_type))
return w;
}
More information about the PyQt
mailing list