From 39adc2418a0586261c6c4aea36f72596c6cf8897 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 21 Nov 2007 13:07:16 +0100 Subject: r26088: Import some native-python python modules and move original python swig torture code to common python directory as well. (This used to be commit cbf656ff054ab2b0b5ca81e1d4f16ac54c8098f1) --- source4/libcli/util/errors.i | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source4/libcli/util') diff --git a/source4/libcli/util/errors.i b/source4/libcli/util/errors.i index 61cb7a090a..d51c9e0ded 100644 --- a/source4/libcli/util/errors.i +++ b/source4/libcli/util/errors.i @@ -36,4 +36,15 @@ } }; +%typemap(in) NTSTATUS { + if (PyLong_Check($input)) + $1 = NT_STATUS(PyLong_AsUnsignedLong($input)); + else if (PyInt_Check($input)) + $1 = NT_STATUS(PyInt_AsLong($input)); + else { + PyErr_SetString(PyExc_TypeError, "Expected a long or an int"); + return NULL; + } +} + #endif -- cgit