summaryrefslogtreecommitdiff
path: root/pidl/lib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-08-28 22:00:21 +1000
committerAndrew Tridgell <tridge@samba.org>2010-09-02 13:37:07 +1000
commit58d92cefe266e423f05dec3a2fef91ebc870c350 (patch)
tree5c7ca8b29709eb16bb9f2f62eb09045109f98697 /pidl/lib
parente7e39584a9dcfd7d98dc10b88baa53019a77e652 (diff)
downloadsamba-58d92cefe266e423f05dec3a2fef91ebc870c350.tar.gz
samba-58d92cefe266e423f05dec3a2fef91ebc870c350.tar.bz2
samba-58d92cefe266e423f05dec3a2fef91ebc870c350.zip
pidl-python: cope with NULL pointers in more places
NULL is converted to Py_None
Diffstat (limited to 'pidl/lib')
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/Python.pm14
1 files changed, 7 insertions, 7 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 05c11be07f..85ce2d64ba 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -873,7 +873,7 @@ sub ConvertObjectFromPythonData($$$$$$;$)
my $ctype_name = $self->use_type_variable($ctype);
unless (defined ($ctype_name)) {
error($location, "Unable to determine origin of type `" . mapTypeName($ctype) . "'");
- $self->pidl("PyErr_SetString(PyExc_TypeError, \"Can not convert C Type " . mapTypeName($ctype) . " to Python\");");
+ $self->pidl("PyErr_SetString(PyExc_TypeError, \"Can not convert C Type " . mapTypeName($ctype) . " from Python\");");
return;
}
$self->pidl("PY_CHECK_TYPE($ctype_name, $cvar, $fail);");
@@ -895,12 +895,12 @@ sub ConvertObjectFromPythonData($$$$$$;$)
if ($actual_ctype->{TYPE} eq "SCALAR" and $actual_ctype->{NAME} eq "ipv4address") {
$self->pidl("$target = PyString_AsString($cvar);");
return;
- }
+ }
if ($actual_ctype->{TYPE} eq "SCALAR" and $actual_ctype->{NAME} eq "dnsp_name") {
$self->pidl("$target = PyString_AsString($cvar);");
return;
- }
+ }
if ($actual_ctype->{TYPE} eq "SCALAR" and $actual_ctype->{NAME} eq "NTSTATUS") {
@@ -1050,13 +1050,13 @@ sub ConvertScalarToPython($$$)
}
if (($ctypename eq "string" or $ctypename eq "nbt_string" or $ctypename eq "nbt_name" or $ctypename eq "wrepl_nbt_name")) {
- return "PyString_FromString($cvar)";
+ return "PyString_FromString_check_null($cvar)";
}
# Not yet supported
if ($ctypename eq "string_array") { return "PyCObject_FromTallocPtr($cvar)"; }
- if ($ctypename eq "ipv4address") { return "PyString_FromString($cvar)"; }
- if ($ctypename eq "dnsp_name") { return "PyString_FromString($cvar)"; }
+ if ($ctypename eq "ipv4address") { return "PyString_FromString_check_null($cvar)"; }
+ if ($ctypename eq "dnsp_name") { return "PyString_FromString_check_null($cvar)"; }
if ($ctypename eq "pointer") {
return "PyCObject_FromTallocPtr($cvar)";
}
@@ -1139,7 +1139,7 @@ sub ConvertObjectToPythonLevel($$$$$$)
if (is_charset_array($e, $l)) {
# FIXME: Use Unix charset setting rather than utf-8
- $self->pidl("$py_var = PyUnicode_Decode($var_name, strlen($var_name), \"utf-8\", \"ignore\");");
+ $self->pidl("$py_var = PyUnicode_Decode_check_null($var_name, strlen($var_name), \"utf-8\", \"ignore\");");
} else {
die("No SIZE_IS for array $var_name") unless (defined($l->{SIZE_IS}));
my $length = $l->{SIZE_IS};