From c827bad43b3fac4ce1a97d11f3ebd2fd140cfb52 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Sat, 20 Mar 2004 00:23:40 +0000 Subject: [PATCH] add argument protection for templates git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5778 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/python/attribute.i | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Lib/python/attribute.i b/Lib/python/attribute.i index af0f638ba..b494ca68a 100644 --- a/Lib/python/attribute.i +++ b/Lib/python/attribute.i @@ -79,7 +79,7 @@ return get; } template - inline type Class ##_## attr ## _set(C *t, const type& val) { + inline void Class ##_## attr ## _set(C *t, const type& val) { set; } %} @@ -87,9 +87,11 @@ %define %attribute(Class, type, attr, get, ...) #if #__VA_ARGS__ != "" - %_attribute(Class, type, attr, t->get(), t->__VA_ARGS__(val)) + %_attribute(SWIG_arg(Class), SWIG_arg(type), + attr, t->get(), t->__VA_ARGS__(val)) #else - %_attribute(Class, type, attr, t->get(), + %_attribute(SWIG_arg(Class), SWIG_arg(type), + attr, t->get(), std::cerr << "'attr' is a read-only attribute" << std::endl); #endif %enddef @@ -106,7 +108,7 @@ return t->ref_name(); } template - inline type Class ##_## attr ## _set(C *t, const type& val) { + inline void Class ##_## attr ## _set(C *t, const type& val) { t->ref_name() = val; } %} @@ -114,8 +116,8 @@ %define %attribute_ref(Class, type, attr, ...) #if #__VA_ARGS__ == "" -%_attribute_ref(Class, type, attr, attr) +%_attribute_ref(SWIG_arg(Class), SWIG_arg(type), attr, attr) #else -%_attribute_ref(Class, type, attr, __VA_ARGS__) +%_attribute_ref(SWIG_arg(Class), SWIG_arg(type), attr, __VA_ARGS__) #endif %enddef