diff --git a/Lib/r/rstdcommon.swg b/Lib/r/rstdcommon.swg index 557dac71b..5f41fd144 100644 --- a/Lib/r/rstdcommon.swg +++ b/Lib/r/rstdcommon.swg @@ -101,12 +101,11 @@ namespace swig { template struct traits_as { - static Type as(SWIG_Object obj, bool throw_error) { + static Type as(SWIG_Object obj) { Type v; int res = asval(obj, &v); if (!obj || !SWIG_IsOK(res)) { - if (throw_error) - throw std::invalid_argument("bad type"); + throw std::invalid_argument("bad type"); } return v; } @@ -114,7 +113,7 @@ namespace swig { template struct traits_as { - static Type as(SWIG_Object obj, bool throw_error) { + static Type as(SWIG_Object obj) { Type *v = 0; int res = (obj ? traits_asptr::asptr(obj, &v) : SWIG_ERROR); if (SWIG_IsOK(res) && v) { @@ -126,12 +125,7 @@ namespace swig { return *v; } } else { - // Uninitialized return value, no Type() constructor required. - static Type *v_def = (Type*) malloc(sizeof(Type)); - if (throw_error) throw std::invalid_argument("bad type"); - memset(v_def,0,sizeof(Type)); - return *v_def; } } }; @@ -152,8 +146,8 @@ namespace swig { }; template - inline Type as(SWIG_Object obj, bool te = false) { - return traits_as::category>::as(obj, te); + inline Type as(SWIG_Object obj) { + return traits_as::category>::as(obj); } template