From d5903fd75e9640831f0e78fc04d3ffa5ea3b1b4a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 14 Jan 2008 02:48:50 +0100 Subject: pidl/python: Fix compilation of py_echo. (This used to be commit 5ee99ff31c80ece6861b2a0323d71170ef9346b9) --- source4/pidl/lib/Parse/Pidl/Samba4/Python.pm | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'source4/pidl/lib/Parse/Pidl/Samba4') diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm index a7e1791793..f569f013dc 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -384,7 +384,7 @@ sub PythonType($$$) $self->EnumAndBitmapConsts($d->{NAME}, $d->{DATA}); } - if ($actual_ctype->{TYPE} eq "UNION") { + if ($actual_ctype->{TYPE} eq "UNION" and defined($actual_ctype->{ELEMENTS})) { $self->pidl("PyObject *py_import_$d->{NAME}(int level, " .mapTypeName($d) . " *in)"); $self->pidl("{"); $self->indent; @@ -486,7 +486,7 @@ sub Interface($$$) $self->pidl(""); $self->register_module_method($interface->{NAME}, "interface_$interface->{NAME}", "METH_VARARGS|METH_KEYWORDS", "NULL"); - $self->pidl("static PyObject *interface_$interface->{NAME}(PyObject *self, PyObject *args)"); + $self->pidl("static PyObject *interface_$interface->{NAME}(PyObject *self, PyObject *args, PyObject *kwargs)"); $self->pidl("{"); $self->indent; $self->pidl("$interface->{NAME}_InterfaceObject *ret;"); @@ -496,6 +496,18 @@ sub Interface($$$) $self->pidl("TALLOC_CTX *mem_ctx = NULL;"); $self->pidl("NTSTATUS status;"); $self->pidl(""); + $self->pidl("const char *kwnames[] = {"); + $self->indent; + $self->pidl("\"binding\", NULL"); + $self->deindent; + $self->pidl("};"); + $self->pidl(""); + $self->pidl("if (!PyArg_ParseTupleAndKeywords(args, kwargs, \"s:$interface->{NAME}\", discard_const_p(char *, kwnames), &binding_string)) {"); + $self->indent; + $self->pidl("return NULL;"); + $self->deindent; + $self->pidl("}"); + $self->pidl(""); # FIXME: Arguments: binding string, credentials, loadparm context $self->pidl("ret = PyObject_New($interface->{NAME}_InterfaceObject, &$interface->{NAME}_InterfaceType);"); -- cgit