From 552e65679df23f488ecee2c0d8555f5e0dad9166 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 30 Dec 2009 18:01:24 +0100 Subject: net: Allow Python commands to return None instead of 0. Signed-off-by: Andrew Tridgell --- source4/utils/net/net.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source4/utils/net') diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c index ee5cdf8e1c..ba935b9986 100644 --- a/source4/utils/net/net.c +++ b/source4/utils/net/net.c @@ -94,7 +94,14 @@ static int py_call_with_string_args(PyObject *self, const char *method, int argc return 1; } - return PyInt_AsLong(ret); + if (ret == Py_None) { + return 0; + } else if (PyInt_Check(ret)) { + return PyInt_AsLong(ret); + } else { + fprintf(stderr, "Function return value type unexpected.\n"); + return -1; + } } static PyObject *py_commands(void) -- cgit