svn commit: samba r2490 - in branches/SAMBA_4_0/source: build/pidl scripting/swig

tpot at samba.org tpot at samba.org
Wed Sep 22 03:42:58 GMT 2004


Author: tpot
Date: 2004-09-22 03:42:58 +0000 (Wed, 22 Sep 2004)
New Revision: 2490

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

Log:
Some changes to take into account non-error NTSTATUS codes being returned:

  - Only throw an exception if NT_STATUS_IS_ERR() instead of 
    !NT_STATUS_IS_OK().

  - Add the NTSTATUS value to the returned dictionary under a key of 
    'result' so calling functions can access it.

Modified:
   branches/SAMBA_4_0/source/build/pidl/swig.pm
   branches/SAMBA_4_0/source/scripting/swig/dcerpc.i


Changeset:
Modified: branches/SAMBA_4_0/source/build/pidl/swig.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/swig.pm	2004-09-22 03:36:17 UTC (rev 2489)
+++ branches/SAMBA_4_0/source/build/pidl/swig.pm	2004-09-22 03:42:58 UTC (rev 2490)
@@ -337,10 +337,10 @@
 
     # Output typemap
 
-    $result .= "%typemap(argout) struct $fn->{NAME} * {\n";
+    $result .= "%typemap(argout) struct $fn->{NAME} * (PyObject *temp) {\n";
     $result .= "\tTALLOC_CTX *mem_ctx = talloc_init(\"typemap(argout) $fn->{NAME}\");\n\n";
 
-    $result .= "\tresultobj = $fn->{NAME}_ptr_to_python(mem_ctx, \$1";
+    $result .= "\ttemp = $fn->{NAME}_ptr_to_python(mem_ctx, \$1";
 
     foreach my $e (@{$fn->{DATA}}) {
 	if ((my $switch_is = util::has_property($e, "switch_is"))) {
@@ -349,6 +349,10 @@
     }
 
     $result .= ");\n\n";
+
+    $result .= "\tPyDict_SetItemString(temp, \"result\", resultobj);\n";
+    $result .= "\tresultobj = temp;\n";
+
     $result .= "\ttalloc_free(mem_ctx);\n";
     $result .= "}\n\n";
 

Modified: branches/SAMBA_4_0/source/scripting/swig/dcerpc.i
===================================================================
--- branches/SAMBA_4_0/source/scripting/swig/dcerpc.i	2004-09-22 03:36:17 UTC (rev 2489)
+++ branches/SAMBA_4_0/source/scripting/swig/dcerpc.i	2004-09-22 03:42:58 UTC (rev 2490)
@@ -289,7 +289,7 @@
 
 %exception {
 	$action
-	if (!NT_STATUS_IS_OK(result)) {
+	if (NT_STATUS_IS_ERR(result)) {
 		set_ntstatus_exception(NT_STATUS_V(result));
 		return NULL;
 	}



More information about the samba-cvs mailing list