svn commit: samba r2425 - in branches/SAMBA_4_0/source/build/pidl: .

tpot at samba.org tpot at samba.org
Mon Sep 20 01:18:10 GMT 2004


Author: tpot
Date: 2004-09-20 01:18:10 +0000 (Mon, 20 Sep 2004)
New Revision: 2425

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/build/pidl&rev=2425&nolog=1

Log:
Found another place for a type check.  When convert a dictionary value
to an array, check that the value exists and it is of list type.

Fix a typo.

Modified:
   branches/SAMBA_4_0/source/build/pidl/swig.pm


Changeset:
Modified: branches/SAMBA_4_0/source/build/pidl/swig.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/swig.pm	2004-09-20 00:55:53 UTC (rev 2424)
+++ branches/SAMBA_4_0/source/build/pidl/swig.pm	2004-09-20 01:18:10 UTC (rev 2425)
@@ -67,6 +67,16 @@
 	$result .= "\ts->$prefix$e->{NAME} = talloc(mem_ctx, $array_len * sizeof($type));\n";
     }
 
+    $result .= "\tif (!PyDict_GetItemString(obj, \"$e->{NAME}\")) {\n";
+    $result .= "\t\tPyErr_Format(PyExc_ValueError, \"Expecting key '%s'\", \"$e->{NAME}\");\n";
+    $result .= "\t\treturn NULL;\n";
+    $result .= "\t}\n\n";
+
+    $result .= "\tif (!PyList_Check(PyDict_GetItemString(obj, \"$e->{NAME}\"))) {\n";
+    $result .= "\t\tPyErr_Format(PyExc_TypeError, \"Expecting list value for key '%s'\", \"$e->{NAME}\");\n";
+    $result .= "\t\treturn NULL;\n";
+    $result .= "\t}\n\n";
+
     $result .= "\t{\n";
 
     $result .= "\t\tint i;\n\n";
@@ -326,8 +336,7 @@
     $result .= "\t\treturn NULL;\n";
     $result .= "\t}\n\n";
 
-    $result .= "\tif (obj == Py_None) return NULL;\n";
-    $result .= "\t}\n\n";
+    $result .= "\tif (obj == Py_None) return NULL;\n\n";
 
     $result .= "\tif (!PyDict_Check(obj)) {\n";
     $result .= "\t\tPyErr_Format(PyExc_TypeError, \"Expecting dict value for key '%s'\", name);\n";



More information about the samba-cvs mailing list