From: Jelmer Vernooij Date: Fri, 12 Dec 2008 12:31:42 +0000 (+0100) Subject: Allow overriding repr function for pidl-defined types. X-Git-Tag: samba-4.0.0alpha6~479^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e2c070395d2fef232ab60d075194091f7b46b35;p=thirdparty%2Fsamba.git Allow overriding repr function for pidl-defined types. --- diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm index 2c64f06aa48..26642759349 100644 --- a/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -295,6 +295,10 @@ sub PythonStruct($$$$$$) $self->pidl_hdr("#define $name\_Check(op) PyObject_TypeCheck(op, &$name\_Type)\n"); $self->pidl_hdr("#define $name\_CheckExact(op) ((op)->ob_type == &$name\_Type)\n"); $self->pidl_hdr("\n"); + $self->pidl("#ifndef ".uc("py_$name\_repr")); + $self->pidl("#define ".uc("py_$name\_repr") . " py_talloc_default_repr"); + $self->pidl("#endif"); + $self->pidl(""); my $docstring = ($self->DocString($d, $name) or "NULL"); my $typeobject = "$name\_Type"; $self->pidl("PyTypeObject $typeobject = {"); @@ -304,7 +308,7 @@ sub PythonStruct($$$$$$) $self->pidl(".tp_basicsize = sizeof(py_talloc_Object),"); $self->pidl(".tp_dealloc = py_talloc_dealloc,"); $self->pidl(".tp_getset = $getsetters,"); - $self->pidl(".tp_repr = py_talloc_default_repr,"); + $self->pidl(".tp_repr = ".uc("py_$name\_repr").","); $self->pidl(".tp_doc = $docstring,"); $self->pidl(".tp_methods = $py_methods,"); $self->pidl(".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,");