From: Douglas Bagnall Date: Tue, 28 May 2024 04:32:14 +0000 (+1200) Subject: pidl:python: properly raise exception in ConvertObjectFromPythonData X-Git-Tag: tdb-1.4.11~507 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f893c100c0743e52b578d2108222c26321805132;p=thirdparty%2Fsamba.git pidl:python: properly raise exception in ConvertObjectFromPythonData Without the `$self->pidl("$fail");`, the exception is not raised. We also try to improve the Python message. Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm index 65cad3ee221..aafce9603a8 100644 --- a/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -1829,7 +1829,8 @@ sub ConvertObjectFromPythonData($$$$$$;$$) my $ctype_name = $self->use_type_variable($ctype); unless (defined ($ctype_name)) { error($location, "Unable to determine origin of type `" . mapTypeName($ctype) . "'"); - $self->pidl("PyErr_SetString(PyExc_TypeError, \"Can not convert C Type " . mapTypeName($ctype) . " from Python\");"); + $self->pidl("PyErr_SetString(PyExc_TypeError, \"Cannot convert Python object to NDR $target\");"); + $self->pidl("$fail"); return; } $self->pidl("PY_CHECK_TYPE($ctype_name, $cvar, $fail);");