summaryrefslogtreecommitdiff
path: root/pidl/lib/Parse
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-06-25 00:16:18 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-06-25 00:16:18 +0200
commit700fcfbc63c4b20fcb35dc3c7ef50ed20117cf74 (patch)
treee2d825da3a59c996dab906a14019bdff52ceed20 /pidl/lib/Parse
parent4a75cb9cd5dfdd347803d03acbc0533c2e7e89cc (diff)
downloadsamba-700fcfbc63c4b20fcb35dc3c7ef50ed20117cf74.tar.gz
samba-700fcfbc63c4b20fcb35dc3c7ef50ed20117cf74.tar.bz2
samba-700fcfbc63c4b20fcb35dc3c7ef50ed20117cf74.zip
pidl/python: Make sure to always increment reference counter when using
Py_None.
Diffstat (limited to 'pidl/lib/Parse')
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/Python.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 4fb8f6be2c..4687a535c4 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -372,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
@@ -391,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";
}