diff --git a/Lib/python/pystdcommon.swg b/Lib/python/pystdcommon.swg index 70746a58e..c8ce2c8e6 100644 --- a/Lib/python/pystdcommon.swg +++ b/Lib/python/pystdcommon.swg @@ -122,7 +122,7 @@ namespace swig { template struct traits_as { - static Type as(PyObject *obj, bool throw_error) { + static Type as(PyObject *obj, bool /* throw_error */) { Type *v = 0; int res = (obj ? traits_asptr::asptr(obj, &v) : SWIG_ERROR); if (SWIG_IsOK(res) && v) { @@ -134,12 +134,10 @@ namespace swig { return *v; } } else { - static Type v_def; if (!PyErr_Occurred()) { %type_error(swig::type_name()); } - if (throw_error) throw std::invalid_argument("bad type"); - return v_def; + throw std::invalid_argument("bad type"); } } };