From 42b5bdf75fe4974cb2e765f887c27d988d5aa28f Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 22 Sep 2004 05:14:15 +0000 Subject: r2496: Check that reference parameters are not None. (This used to be commit a2ab6c5ef9cc6db27fc8c73e6117f0f7a116d563) --- source4/build/pidl/swig.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/build/pidl/swig.pm b/source4/build/pidl/swig.pm index ae52ab3d9d..dd007ffbd4 100644 --- a/source4/build/pidl/swig.pm +++ b/source4/build/pidl/swig.pm @@ -261,7 +261,15 @@ sub ParseFunction($) $result .= "\tmemset(s, 0, sizeof(struct $fn->{NAME}));\n\n"; foreach my $e (@{$fn->{DATA}}) { - $result .= FieldFromPython($e, "in.") if util::has_property($e, "in") + if (util::has_property($e, "in")) { + if (util::has_property($e, "ref")) { + $result .= "\tif (PyDict_GetItemString(obj, \"$e->{NAME}\") == Py_None) {\n"; + $result .= "\t\tPyErr_Format(PyExc_ValueError, \"Key '$e->{NAME}' cannot be None\");\n"; + $result .= "\t\treturn NULL;\n"; + $result .= "\t}\n"; + } + $result .= FieldFromPython($e, "in.") ; + } } $result .= "\n"; -- cgit