Lines 377-383
Link Here
|
377 |
if (PyType_Ready(&sipWrapperType_Type) < 0) |
377 |
if (PyType_Ready(&sipWrapperType_Type) < 0) |
378 |
Py_FatalError("sip: Failed to initialise sip.wrappertype type"); |
378 |
Py_FatalError("sip: Failed to initialise sip.wrappertype type"); |
379 |
|
379 |
|
380 |
if (PyType_Ready(&sipWrapper_Type.super.type) < 0) |
380 |
if (PyType_Ready(&sipWrapper_Type.super.ht_type) < 0) |
381 |
Py_FatalError("sip: Failed to initialise sip.wrapper type"); |
381 |
Py_FatalError("sip: Failed to initialise sip.wrapper type"); |
382 |
|
382 |
|
383 |
if (PyType_Ready(&sipVoidPtr_Type) < 0) |
383 |
if (PyType_Ready(&sipVoidPtr_Type) < 0) |
Lines 811-817
Link Here
|
811 |
{ |
811 |
{ |
812 |
sipWrapperType *wt; |
812 |
sipWrapperType *wt; |
813 |
|
813 |
|
814 |
if ((wt = *mw++) != NULL && addInstances(wt->super.type.tp_dict, &wt->type->td_instances) < 0) |
814 |
if ((wt = *mw++) != NULL && addInstances(wt->super.ht_type.tp_dict, &wt->type->td_instances) < 0) |
815 |
return -1; |
815 |
return -1; |
816 |
} |
816 |
} |
817 |
|
817 |
|
Lines 3165-3171
Link Here
|
3165 |
if (type->td_scope.sc_flag) |
3165 |
if (type->td_scope.sc_flag) |
3166 |
dict = mod_dict; |
3166 |
dict = mod_dict; |
3167 |
else |
3167 |
else |
3168 |
dict = getClassType(&type->td_scope, client)->super.type.tp_dict; |
3168 |
dict = getClassType(&type->td_scope, client)->super.ht_type.tp_dict; |
3169 |
|
3169 |
|
3170 |
/* Add the type to the "parent" dictionary. */ |
3170 |
/* Add the type to the "parent" dictionary. */ |
3171 |
if (PyDict_SetItem(dict,name,(PyObject *)wt) < 0) |
3171 |
if (PyDict_SetItem(dict,name,(PyObject *)wt) < 0) |
Lines 3215-3221
Link Here
|
3215 |
if (ed->e_scope < 0) |
3215 |
if (ed->e_scope < 0) |
3216 |
dict = mod_dict; |
3216 |
dict = mod_dict; |
3217 |
else |
3217 |
else |
3218 |
dict = client->em_types[ed->e_scope]->super.type.tp_dict; |
3218 |
dict = client->em_types[ed->e_scope]->super.ht_type.tp_dict; |
3219 |
|
3219 |
|
3220 |
/* Create the base type tuple if it hasn't already been done. */ |
3220 |
/* Create the base type tuple if it hasn't already been done. */ |
3221 |
if (bases == NULL && (bases = Py_BuildValue("(O)",&PyInt_Type)) == NULL) |
3221 |
if (bases == NULL && (bases = Py_BuildValue("(O)",&PyInt_Type)) == NULL) |
Lines 3401-3407
Link Here
|
3401 |
|
3401 |
|
3402 |
self = PyTuple_GET_ITEM(args,argnr); |
3402 |
self = PyTuple_GET_ITEM(args,argnr); |
3403 |
|
3403 |
|
3404 |
if (!PyObject_TypeCheck(self,&type -> super.type)) |
3404 |
if (!PyObject_TypeCheck(self,&type -> super.ht_type)) |
3405 |
return PARSE_UNBOUND; |
3405 |
return PARSE_UNBOUND; |
3406 |
|
3406 |
|
3407 |
*selfp = (sipWrapper *)self; |
3407 |
*selfp = (sipWrapper *)self; |
Lines 4273-4279
Link Here
|
4273 |
{ |
4273 |
{ |
4274 |
/* If this is a wrapped type then get the type dictionary. */ |
4274 |
/* If this is a wrapped type then get the type dictionary. */ |
4275 |
if (sipWrapperType_Check(dict)) |
4275 |
if (sipWrapperType_Check(dict)) |
4276 |
dict = ((sipWrapperType *)dict)->super.type.tp_dict; |
4276 |
dict = ((sipWrapperType *)dict)->super.ht_type.tp_dict; |
4277 |
|
4277 |
|
4278 |
return addSingleEnumInstance(dict, name, value, type); |
4278 |
return addSingleEnumInstance(dict, name, value, type); |
4279 |
} |
4279 |
} |
Lines 4323-4329
Link Here
|
4323 |
{ |
4323 |
{ |
4324 |
/* If this is a wrapped type then get the type dictionary. */ |
4324 |
/* If this is a wrapped type then get the type dictionary. */ |
4325 |
if (sipWrapperType_Check(dict)) |
4325 |
if (sipWrapperType_Check(dict)) |
4326 |
dict = ((sipWrapperType *)dict) -> super.type.tp_dict; |
4326 |
dict = ((sipWrapperType *)dict) -> super.ht_type.tp_dict; |
4327 |
|
4327 |
|
4328 |
return addSingleClassInstance(dict,name,cppPtr,wt,0); |
4328 |
return addSingleClassInstance(dict,name,cppPtr,wt,0); |
4329 |
} |
4329 |
} |
Lines 4340-4346
Link Here
|
4340 |
|
4340 |
|
4341 |
/* If this is a wrapped type then get the type dictionary. */ |
4341 |
/* If this is a wrapped type then get the type dictionary. */ |
4342 |
if (sipWrapperType_Check(dict)) |
4342 |
if (sipWrapperType_Check(dict)) |
4343 |
dict = ((sipWrapperType *)dict)->super.type.tp_dict; |
4343 |
dict = ((sipWrapperType *)dict)->super.ht_type.tp_dict; |
4344 |
|
4344 |
|
4345 |
if ((w = mt->mt_cfrom(cppPtr, NULL)) == NULL) |
4345 |
if ((w = mt->mt_cfrom(cppPtr, NULL)) == NULL) |
4346 |
return -1; |
4346 |
return -1; |
Lines 4521-4527
Link Here
|
4521 |
if (pyObj == Py_None) |
4521 |
if (pyObj == Py_None) |
4522 |
ok = ((flags & SIP_NOT_NONE) == 0); |
4522 |
ok = ((flags & SIP_NOT_NONE) == 0); |
4523 |
else if (cto == NULL || (flags & SIP_NO_CONVERTORS) != 0) |
4523 |
else if (cto == NULL || (flags & SIP_NO_CONVERTORS) != 0) |
4524 |
ok = PyObject_TypeCheck(pyObj, &type->super.type); |
4524 |
ok = PyObject_TypeCheck(pyObj, &type->super.ht_type); |
4525 |
else |
4525 |
else |
4526 |
ok = cto(pyObj, NULL, NULL, NULL); |
4526 |
ok = cto(pyObj, NULL, NULL, NULL); |
4527 |
|
4527 |
|
Lines 4941-4947
Link Here
|
4941 |
* convertor might be able to convert the target type |
4941 |
* convertor might be able to convert the target type |
4942 |
* to something more specific. |
4942 |
* to something more specific. |
4943 |
*/ |
4943 |
*/ |
4944 |
if (PyType_IsSubtype(&type -> super.type,&scc -> scc_basetype -> super.type)) |
4944 |
if (PyType_IsSubtype(&type -> super.ht_type,&scc -> scc_basetype -> super.ht_type)) |
4945 |
{ |
4945 |
{ |
4946 |
sipWrapperType *subtype; |
4946 |
sipWrapperType *subtype; |
4947 |
|
4947 |
|
Lines 5495-5501
Link Here
|
5495 |
* We check by comparing the actual type name with the name used to |
5495 |
* We check by comparing the actual type name with the name used to |
5496 |
* create the original wrapped type. |
5496 |
* create the original wrapped type. |
5497 |
*/ |
5497 |
*/ |
5498 |
if ((name = PyString_AsString(wt->super.name)) == NULL) |
5498 |
if ((name = PyString_AsString(wt->super.ht_name)) == NULL) |
5499 |
return FALSE; |
5499 |
return FALSE; |
5500 |
|
5500 |
|
5501 |
return (strcmp(name, getBaseName(wt->type->td_name)) == 0); |
5501 |
return (strcmp(name, getBaseName(wt->type->td_name)) == 0); |
Lines 5551-5557
Link Here
|
5551 |
*/ |
5551 |
*/ |
5552 |
if (self -> type == NULL) |
5552 |
if (self -> type == NULL) |
5553 |
{ |
5553 |
{ |
5554 |
PyObject *sc = self->super.type.tp_base; |
5554 |
PyObject *sc = self->super.ht_type.tp_base; |
5555 |
|
5555 |
|
5556 |
/* |
5556 |
/* |
5557 |
* Make sure that the type is derived from sip.wrapper. It |
5557 |
* Make sure that the type is derived from sip.wrapper. It |
Lines 5560-5566
Link Here
|
5560 |
*/ |
5560 |
*/ |
5561 |
if (sc == NULL || !sipWrapperType_Check(sc)) |
5561 |
if (sc == NULL || !sipWrapperType_Check(sc)) |
5562 |
{ |
5562 |
{ |
5563 |
PyErr_Format(PyExc_TypeError, "type %s must be derived from sip.wrapper", self->super.type.tp_name); |
5563 |
PyErr_Format(PyExc_TypeError, "type %s must be derived from sip.wrapper", self->super.ht_type.tp_name); |
5564 |
return -1; |
5564 |
return -1; |
5565 |
} |
5565 |
} |
5566 |
|
5566 |
|
Lines 5595-5601
Link Here
|
5595 |
PyObject *dict; |
5595 |
PyObject *dict; |
5596 |
PyMethodDef *pmd; |
5596 |
PyMethodDef *pmd; |
5597 |
|
5597 |
|
5598 |
dict = wt -> super.type.tp_dict; |
5598 |
dict = wt -> super.ht_type.tp_dict; |
5599 |
|
5599 |
|
5600 |
/* The base type doesn't have any type information. */ |
5600 |
/* The base type doesn't have any type information. */ |
5601 |
if ((td = wt->type) == NULL || !isExactWrappedType(wt)) |
5601 |
if ((td = wt->type) == NULL || !isExactWrappedType(wt)) |
Lines 5813-5819
Link Here
|
5813 |
} |
5813 |
} |
5814 |
|
5814 |
|
5815 |
/* See if it is an abstract type. */ |
5815 |
/* See if it is an abstract type. */ |
5816 |
if (sipTypeIsAbstract(wt) && strcmp(strchr(wt->type->td_name, '.') + 1, wt->super.type.tp_name) == 0) |
5816 |
if (sipTypeIsAbstract(wt) && strcmp(strchr(wt->type->td_name, '.') + 1, wt->super.ht_type.tp_name) == 0) |
5817 |
{ |
5817 |
{ |
5818 |
PyErr_Format(PyExc_TypeError, "%s represents a C++ abstract class and cannot be instantiated", wt->type->td_name); |
5818 |
PyErr_Format(PyExc_TypeError, "%s represents a C++ abstract class and cannot be instantiated", wt->type->td_name); |
5819 |
|
5819 |
|
Lines 5822-5828
Link Here
|
5822 |
} |
5822 |
} |
5823 |
|
5823 |
|
5824 |
/* Call the standard super-type new. */ |
5824 |
/* Call the standard super-type new. */ |
5825 |
return PyBaseObject_Type.tp_new(&wt -> super.type,args,kwds); |
5825 |
return PyBaseObject_Type.tp_new(&wt -> super.ht_type,args,kwds); |
5826 |
} |
5826 |
} |
5827 |
|
5827 |
|
5828 |
|
5828 |
|
Lines 6389-6395
Link Here
|
6389 |
|
6389 |
|
6390 |
/* Add the slots for this type. */ |
6390 |
/* Add the slots for this type. */ |
6391 |
if (td -> td_pyslots != NULL) |
6391 |
if (td -> td_pyslots != NULL) |
6392 |
initSlots(&wt->super.type, &wt->super.as_number, &wt->super.as_sequence, &wt->super.as_mapping, td->td_pyslots, FALSE); |
6392 |
initSlots(&wt->super.ht_type, &wt->super.as_number, &wt->super.as_sequence, &wt->super.as_mapping, td->td_pyslots, FALSE); |
6393 |
|
6393 |
|
6394 |
/* Recurse through any super-types. */ |
6394 |
/* Recurse through any super-types. */ |
6395 |
if ((sup = td -> td_supers) != NULL) |
6395 |
if ((sup = td -> td_supers) != NULL) |