summaryrefslogtreecommitdiffstats
path: root/libshiboken/conversions.h
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-04-05 18:25:42 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2010-04-06 14:06:21 -0300
commitb312f591f757af4616c87e5c5cc477150cd032ca (patch)
tree7d156541f3152ca994681672c63721b0e405dc7a /libshiboken/conversions.h
parent71f54720342ad64826fa469c18e22ec7bcde0b4d (diff)
downloadshiboken-b312f591f757af4616c87e5c5cc477150cd032ca.tar.gz
shiboken-b312f591f757af4616c87e5c5cc477150cd032ca.tar.xz
shiboken-b312f591f757af4616c87e5c5cc477150cd032ca.zip
Only convert None to a null pointer when there aren't conversions defined for it.
Reviewer: Anderson Lizardo <anderson.lizardo@openbossa.org> Reviewer: Bruno Ara├║jo <bruno.araujo@openbossa.org>
Diffstat (limited to 'libshiboken/conversions.h')
-rw-r--r--libshiboken/conversions.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/libshiboken/conversions.h b/libshiboken/conversions.h
index b1d57eb6..91243a07 100644
--- a/libshiboken/conversions.h
+++ b/libshiboken/conversions.h
@@ -150,12 +150,13 @@ struct Converter<T*>
static T* toCpp(PyObject* pyobj)
{
- if (pyobj == Py_None)
- return 0;
- else if (Shiboken_TypeCheck(pyobj, T))
+ if (Shiboken_TypeCheck(pyobj, T))
return (T*) getCppPointer(pyobj, SbkType<T>());
else if (Converter<T>::isConvertible(pyobj))
return CppObjectCopier<T>::copy(Converter<T>::toCpp(pyobj));
+ else if (pyobj == Py_None)
+ return 0;
+ assert(false);
return 0;
}
};