BUG: https://bugzilla.samba.org/show_bug.cgi?id=12601
authorGuy Harris <guy@alum.mit.edu>
Mon, 25 Sep 2017 05:01:11 +0000 (22:01 -0700)
committerGuy Harris <guy@alum.mit.edu>
Mon, 25 Sep 2017 05:02:04 +0000 (05:02 +0000)
Pick up change from Samba:

    commit d62eb3cc9f97b203d21ec6e75c48c739a43bc163
    Author: Stefan Metzmacher <metze@samba.org>
    Date:   Wed Feb 22 10:08:46 2017 +0100

        pidl:Python: make sure print HASH references for STRUCT types

        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>
Change-Id: Ieef766844ce66160eaaacecc73a51f94f69319fb
Reviewed-on: https://code.wireshark.org/review/23717
Reviewed-by: Guy Harris <guy@alum.mit.edu>
tools/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("},");
                }