From 4607dd57a9051ae5bbb277e3498e0fcc335d7b4e Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Mon, 25 Oct 2004 19:04:51 +0000 Subject: [PATCH] fix ref+int overload git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6496 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Lib/python/pyswigtype.swg | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/SWIG/Lib/python/pyswigtype.swg b/SWIG/Lib/python/pyswigtype.swg index 4a75b2a0d..b3d741cfe 100644 --- a/SWIG/Lib/python/pyswigtype.swg +++ b/SWIG/Lib/python/pyswigtype.swg @@ -221,14 +221,25 @@ } } +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE & +{ + void *ptr = 0; + if (SWIG_ConvertPtr($input, &ptr, $descriptor, 0) == -1) { + $1 = 0; + PyErr_Clear(); + } else { + $1 = (ptr != 0); + } +} + %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE { - void *ptr; + void *ptr = 0; if (SWIG_ConvertPtr($input, &ptr, $&descriptor, 0) == -1) { $1 = 0; PyErr_Clear(); } else { - $1 = 1; + $1 = (ptr != 0); } }