diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2010-10-27 15:56:58 -0200 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:08:54 -0300 |
commit | b8b6a8b0316668a8af08b651537747ede08e0c96 (patch) | |
tree | 7ee93de70987688fc76eeeee77b711dbafa1aeda /libshiboken | |
parent | 34cce54d695330ebfa047dbbb4c1c0ab60e22c74 (diff) |
Simplifies the generated code removing the use of std::auto_ptr.
Diffstat (limited to 'libshiboken')
-rw-r--r-- | libshiboken/conversions.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libshiboken/conversions.h b/libshiboken/conversions.h index f393dfbfe..475902ead 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>())); } |