From bfaafde020dc7e38d3a147b0fdbd79adaf68df96 Mon Sep 17 00:00:00 2001 From: Mike Romberg Date: Mon, 3 Jul 2017 12:25:04 -0600 Subject: [PATCH] traits_as::as() ignores throw_error and always throws. --- Lib/python/pystdcommon.swg | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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"); } } };