From 957a4055747089737c1f71752378947cd2730e3d Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Fri, 6 Jan 2006 21:37:59 +0000 Subject: [PATCH] fix problem with containers reported by John Koleszar git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8262 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/python/pycontainer.swg | 2 +- Lib/python/pystdcommon.swg | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Lib/python/pycontainer.swg b/Lib/python/pycontainer.swg index d37ad48bf..3695998f6 100644 --- a/Lib/python/pycontainer.swg +++ b/Lib/python/pycontainer.swg @@ -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) { diff --git a/Lib/python/pystdcommon.swg b/Lib/python/pystdcommon.swg index fc181c69c..fa8d047fd 100644 --- a/Lib/python/pystdcommon.swg +++ b/Lib/python/pystdcommon.swg @@ -162,22 +162,22 @@ namespace swig { template struct traits_check { - 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 struct traits_check { - 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 - inline int check(PyObject *obj) { + inline bool check(PyObject *obj) { return traits_check::category>::check(obj); } }