traits_as<Type,...>::as() ignores throw_error and always throws.
This commit is contained in:
parent
6c0885ff67
commit
bfaafde020
1 changed files with 2 additions and 4 deletions
|
|
@ -122,7 +122,7 @@ namespace swig {
|
||||||
|
|
||||||
template <class Type>
|
template <class Type>
|
||||||
struct traits_as<Type, pointer_category> {
|
struct traits_as<Type, pointer_category> {
|
||||||
static Type as(PyObject *obj, bool throw_error) {
|
static Type as(PyObject *obj, bool /* throw_error */) {
|
||||||
Type *v = 0;
|
Type *v = 0;
|
||||||
int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR);
|
int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR);
|
||||||
if (SWIG_IsOK(res) && v) {
|
if (SWIG_IsOK(res) && v) {
|
||||||
|
|
@ -134,12 +134,10 @@ namespace swig {
|
||||||
return *v;
|
return *v;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
static Type v_def;
|
|
||||||
if (!PyErr_Occurred()) {
|
if (!PyErr_Occurred()) {
|
||||||
%type_error(swig::type_name<Type>());
|
%type_error(swig::type_name<Type>());
|
||||||
}
|
}
|
||||||
if (throw_error) throw std::invalid_argument("bad type");
|
throw std::invalid_argument("bad type");
|
||||||
return v_def;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue