[SCM] Samba Shared Repository - branch master updated

Jelmer Vernooij jelmer at samba.org
Thu Jun 24 16:58:34 MDT 2010


The branch, master has been updated
       via  700fcfb... pidl/python: Make sure to always increment reference counter when using Py_None.
       via  4a75cb9... pidl/python: Increment reference counter on Py_None to prevent us from accidentally deallocating it.
      from  7e49a58... s4 torture: Warn on NOT_IMPLEMENTED in addition to NOT_SUPPORTED for RAW-QFILEINFO

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 700fcfbc63c4b20fcb35dc3c7ef50ed20117cf74
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Fri Jun 25 00:16:18 2010 +0200

    pidl/python: Make sure to always increment reference counter when using
    Py_None.

commit 4a75cb9cd5dfdd347803d03acbc0533c2e7e89cc
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Jun 24 23:17:51 2010 +0200

    pidl/python: Increment reference counter on Py_None to prevent us from
    accidentally deallocating it.

-----------------------------------------------------------------------

Summary of changes:
 pidl/lib/Parse/Pidl/Samba4/Python.pm |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 390ee27..4687a53 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -126,6 +126,7 @@ sub FromUnionToPythonFunction($$$$)
 			$self->ConvertObjectToPython($mem_ctx, {}, $e, "$name->$e->{NAME}", "ret", "return NULL;");
 		} else {
 			$self->pidl("ret = Py_None;");
+			$self->pidl("Py_INCREF(ret);");
 		}
 
 		$self->pidl("return ret;");
@@ -371,7 +372,7 @@ sub PythonFunctionUnpackOut($$$)
 	$self->pidl("static PyObject *$outfnname(struct $fn->{NAME} *r)");
 	$self->pidl("{");
 	$self->indent;
-	$self->pidl("PyObject *result = Py_None;");
+	$self->pidl("PyObject *result;");
 	foreach my $e (@{$fn->{ELEMENTS}}) {
 		next unless (grep(/out/,@{$e->{DIRECTION}}));
 		next if (($metadata_args->{in}->{$e->{NAME}} and grep(/in/, @{$e->{DIRECTION}})) or 
@@ -390,6 +391,8 @@ sub PythonFunctionUnpackOut($$$)
 		$self->pidl("result = PyTuple_New($result_size);");
 		$signature .= "(";
 	} elsif ($result_size == 0) {
+		$self->pidl("result = Py_None;");
+		$self->pidl("Py_INCREF(result);");
 		$signature .= "None";
 	}
 
@@ -1052,6 +1055,7 @@ sub ConvertObjectToPythonLevel($$$$$$)
 			$self->pidl("if ($var_name == NULL) {");
 			$self->indent;
 			$self->pidl("$py_var = Py_None;");
+			$self->pidl("Py_INCREF($py_var);");
 			$self->deindent;
 			$self->pidl("} else {");
 			$self->indent;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list