summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libshiboken/basewrapper.cpp5
-rw-r--r--libshiboken/basewrapper.h2
-rw-r--r--libshiboken/conversions.h10
3 files changed, 8 insertions, 9 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp
index 0214998a..af61aa00 100644
--- a/libshiboken/basewrapper.cpp
+++ b/libshiboken/basewrapper.cpp
@@ -666,14 +666,13 @@ void releaseOwnership(PyObject* pyObj)
setSequenceOwnership(pyObj, false);
}
-void* cppPointer(PyObject* pyObj, PyTypeObject* desiredType)
+void* cppPointer(SbkObject* pyObj, PyTypeObject* desiredType)
{
- assert(isShibokenType(pyObj));
PyTypeObject* type = pyObj->ob_type;
int idx = 0;
if (reinterpret_cast<SbkObjectType*>(type)->is_multicpp)
idx = getTypeIndexOnHierarchy(type, desiredType);
- return reinterpret_cast<SbkObject*>(pyObj)->d->cptr[idx];
+ return pyObj->d->cptr[idx];
}
bool setCppPointer(SbkObject* sbkObj, PyTypeObject* desiredType, void* cptr)
diff --git a/libshiboken/basewrapper.h b/libshiboken/basewrapper.h
index bc3ecf53..0c85e907 100644
--- a/libshiboken/basewrapper.h
+++ b/libshiboken/basewrapper.h
@@ -206,7 +206,7 @@ LIBSHIBOKEN_API void releaseOwnership(SbkObject* pyObj);
/**
* Get the C++ pointer of type \p desiredType from a Python object.
*/
-LIBSHIBOKEN_API void* cppPointer(PyObject* pyObj, PyTypeObject* desiredType);
+LIBSHIBOKEN_API void* cppPointer(SbkObject* pyObj, PyTypeObject* desiredType);
/**
* Set the C++ pointer of type \p desiredType of a Python object.
diff --git a/libshiboken/conversions.h b/libshiboken/conversions.h
index c52e1e4a..d8e28371 100644
--- a/libshiboken/conversions.h
+++ b/libshiboken/conversions.h
@@ -150,7 +150,7 @@ struct Converter<T*>
static T* toCpp(PyObject* pyobj)
{
if (PyObject_TypeCheck(pyobj, SbkType<T>()))
- return (T*) Wrapper::cppPointer(pyobj, SbkType<T>());
+ return (T*) Wrapper::cppPointer(reinterpret_cast<SbkObject*>(pyobj), SbkType<T>());
else if (Converter<T>::isConvertible(pyobj))
return CppObjectCopier<T>::copy(Converter<T>::toCpp(pyobj));
else if (pyobj == Py_None)
@@ -241,7 +241,7 @@ struct ValueTypeConverter
}
assert(false);
}
- return *reinterpret_cast<T*>(Wrapper::cppPointer(pyobj, SbkType<T>()));
+ return *reinterpret_cast<T*>(Wrapper::cppPointer(reinterpret_cast<SbkObject*>(pyobj), SbkType<T>()));
}
};
@@ -275,8 +275,8 @@ struct ObjectTypeConverter
return 0;
SbkObjectType* shiboType = reinterpret_cast<SbkObjectType*>(pyobj->ob_type);
if (shiboType->mi_specialcast)
- return (T*) shiboType->mi_specialcast(Wrapper::cppPointer(pyobj, SbkType<T>()), reinterpret_cast<SbkObjectType*>(SbkType<T>()));
- return (T*) Wrapper::cppPointer(pyobj, SbkType<T>());
+ return (T*) shiboType->mi_specialcast(Wrapper::cppPointer(reinterpret_cast<SbkObject*>(pyobj), SbkType<T>()), reinterpret_cast<SbkObjectType*>(SbkType<T>()));
+ return (T*) Wrapper::cppPointer(reinterpret_cast<SbkObject*>(pyobj), SbkType<T>());
}
};
@@ -585,7 +585,7 @@ struct StdListConverter
static StdList toCpp(PyObject* pyobj)
{
if (PyObject_TypeCheck(pyobj, SbkType<StdList>()))
- return *reinterpret_cast<StdList*>(Wrapper::cppPointer(pyobj, SbkType<StdList>()));
+ return *reinterpret_cast<StdList*>(Wrapper::cppPointer(reinterpret_cast<SbkObject*>(pyobj), SbkType<StdList>()));
StdList result;
for (int i = 0; i < PySequence_Size(pyobj); i++) {