fix problem with containers reported by John Koleszar

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8262 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-01-06 21:37:59 +00:00
commit 5612807986
2 changed files with 8 additions and 8 deletions

View file

@ -699,7 +699,7 @@ namespace swig {
*seq = pseq;
return SWIG_NEWOBJ;
} else {
return pyseq.check();
return pyseq.check() ? SWIG_OK : SWIG_ERROR;
}
} catch (std::exception& e) {
if (seq) {

View file

@ -162,22 +162,22 @@ namespace swig {
template <class Type>
struct traits_check<Type, value_category> {
static int check(PyObject *obj) {
int res = asval(obj, (Type *)(0));
return obj && SWIG_IsOK(res) ? res : 0;
static bool check(PyObject *obj) {
int res = obj ? asval(obj, (Type *)(0)) : SWIG_ERROR;
return SWIG_IsOK(res) ? true : false;
}
};
template <class Type>
struct traits_check<Type, pointer_category> {
static int check(PyObject *obj) {
int res = asptr(obj, (Type **)(0));
return obj && SWIG_IsOK(res) ? res : 0;
static bool check(PyObject *obj) {
int res = obj ? asptr(obj, (Type **)(0)) : SWIG_ERROR;
return SWIG_IsOK(res) ? true : false;
}
};
template <class Type>
inline int check(PyObject *obj) {
inline bool check(PyObject *obj) {
return traits_check<Type, typename traits<Type>::category>::check(obj);
}
}