From ea78a5ce8301ecea3c8901d96944ad06744535e4 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 30 May 2024 10:53:24 +1200 Subject: [PATCH] pidl:python: Exception if unconvertable in ConvertObjectToPythonLevel Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- pidl/lib/Parse/Pidl/Samba4/Python.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm index aafce9603a8..d7ccf8309e8 100644 --- a/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -2295,6 +2295,10 @@ sub ConvertObjectToPythonLevel($$$$$$$) } my $conv = $self->ConvertObjectToPythonData($mem_ctx, $l->{DATA_TYPE}, $var_name, $e->{ORIGINAL}); $self->pidl("$py_var = $conv;"); + if ($conv eq "NULL") { + $self->pidl("PyErr_SetString(PyExc_NotImplementedError, \"Cannot convert NDR $var_name to Python\");"); + $self->pidl("$fail"); + } } elsif ($l->{TYPE} eq "SUBCONTEXT") { $self->ConvertObjectToPythonLevel($mem_ctx, $env, $e, $nl, $var_name, $py_var, $fail, $recurse); } else {