pidl:Python: make sure print HASH references for STRUCT types
authorStefan Metzmacher <metze@samba.org>
Wed, 22 Feb 2017 09:08:46 +0000 (10:08 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 25 Feb 2017 01:39:11 +0000 (02:39 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12601

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
pidl/lib/Parse/Pidl/Samba4/Python.pm

index 5edf96c5993e3a7c39eed4c589e3bbbe9c400f9c..41b50e4973703d6ae71318663cde21cbfa7eb3a0 100644 (file)
@@ -245,12 +245,18 @@ sub PythonStruct($$$$$$)
                $self->pidl("static PyGetSetDef ".$getsetters."[] = {");
                $self->indent;
                foreach my $e (@{$d->{ELEMENTS}}) {
+                       my $etype = "";
+                       if (ref($e->{TYPE}) eq "HASH") {
+                               $etype = $e->{TYPE}->{NAME};
+                       } else {
+                               $etype = $e->{TYPE};
+                       }
                        $self->pidl("{");
                        $self->indent;
                        $self->pidl(".name = discard_const_p(char, \"$e->{NAME}\"),");
                        $self->pidl(".get = py_$name\_get_$e->{NAME},");
                        $self->pidl(".set = py_$name\_set_$e->{NAME},");
-                       $self->pidl(".doc = discard_const_p(char, \"PIDL-generated element of base type $e->{TYPE}\")");
+                       $self->pidl(".doc = discard_const_p(char, \"PIDL-generated element of base type $etype\")");
                        $self->deindent;
                        $self->pidl("},");
                }