add castmode in python and cleaning the castdispatch mechanism

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8051 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-12-23 09:22:17 +00:00
commit 5a76bc68fc
16 changed files with 461 additions and 101 deletions

View file

@ -99,7 +99,7 @@ namespace swig {
struct traits_as<Type, value_category> {
static Type as(PyObject *obj, bool throw_error) {
Type v;
if (!obj || (asval(obj, &v) != SWIG_OK)) {
if (!obj || !SWIG_IsOK(asval(obj, &v))) {
if (!PyErr_Occurred()) {
%type_error(swig::type_name<Type>());
}
@ -160,7 +160,7 @@ namespace swig {
template <class Type>
struct traits_check<Type, value_category> {
static bool check(PyObject *obj) {
return obj && (asval(obj, (Type *)(0)) == SWIG_OK);
return obj && SWIG_IsOK(asval(obj, (Type *)(0)));
}
};