summaryrefslogtreecommitdiffstats
path: root/libshiboken/conversions.h
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-10-27 15:56:58 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2010-10-28 15:12:05 -0200
commitaee6f385b5ffbed54df2e18ece072a7cc3281768 (patch)
tree75679b25044dd50c5cc012088d9752e596ed9b8a /libshiboken/conversions.h
parent45f10c2264bef5c25e493bb6f70ef6355a7f94d1 (diff)
downloadshiboken-aee6f385b5ffbed54df2e18ece072a7cc3281768.tar.gz
shiboken-aee6f385b5ffbed54df2e18ece072a7cc3281768.tar.xz
shiboken-aee6f385b5ffbed54df2e18ece072a7cc3281768.zip
Simplifies the generated code removing the use of std::auto_ptr.
Diffstat (limited to 'libshiboken/conversions.h')
-rw-r--r--libshiboken/conversions.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/libshiboken/conversions.h b/libshiboken/conversions.h
index f393dfbf..475902ea 100644
--- a/libshiboken/conversions.h
+++ b/libshiboken/conversions.h
@@ -234,14 +234,14 @@ struct ValueTypeConverter
// use them if it is the case.
static inline T toCpp(PyObject* pyobj)
{
- PyTypeObject* typeObj = SbkType<T>();
- if (typeObj->ob_type == &Shiboken::SbkBaseWrapperType_Type) {
- SbkBaseWrapperType* shiboType = reinterpret_cast<SbkBaseWrapperType*>(typeObj);
+ if (!PyObject_TypeCheck(pyobj, SbkType<T>())) {
+ SbkBaseWrapperType* shiboType = reinterpret_cast<SbkBaseWrapperType*>(SbkType<T>());
if (shiboType->ext_tocpp && isConvertible(pyobj)) {
T* cptr = reinterpret_cast<T*>(shiboType->ext_tocpp(pyobj));
std::auto_ptr<T> cptr_auto_ptr(cptr);
return *cptr;
}
+ assert(false);
}
return *reinterpret_cast<T*>(getCppPointer(pyobj, SbkType<T>()));
}