aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-03-14 18:17:03 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:15:17 -0300
commitce12dc6531973ee52e82c381217040e6f30a5863 (patch)
tree4bc1f941a337527a789d207a6cfb17dfdf0ecc3b /libshiboken
parente0db9cbc9d4f53f7acea0e58393de133e23f3344 (diff)
Avoid declar shiboken classes derived from old style objects.
Fixes bug #704. Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'libshiboken')
-rw-r--r--libshiboken/basewrapper.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp
index fe575da6d..d296d061e 100644
--- a/libshiboken/basewrapper.cpp
+++ b/libshiboken/basewrapper.cpp
@@ -212,6 +212,17 @@ PyObject* SbkObjectTypeTpNew(PyTypeObject* metatype, PyObject* args, PyObject* k
Shiboken::ObjectType::initPrivateData(newType);
SbkObjectTypePrivate* d = newType->d;
+ // Check if all objects are python new style
+ PyObject* pyBases = ((PyTypeObject*)newType)->tp_bases;
+ for(int i=0, i_max=PyTuple_GET_SIZE(pyBases); i < i_max; i++) {
+ PyObject* baseType = PyTuple_GET_ITEM(pyBases, i);
+ if (PyClass_Check(baseType)) {
+ PyErr_Format(PyExc_TypeError, "Invalid base class used in type %s. PySide only support multiple inheritance from python new style class.", metatype->tp_name);
+ return 0;
+ }
+ }
+
+
std::list<SbkObjectType*> bases = Shiboken::getCppBaseClasses(reinterpret_cast<PyTypeObject*>(newType));
if (bases.size() == 1) {
SbkObjectTypePrivate* parentType = bases.front()->d;