diff options
Diffstat (limited to 'source4/libcli/util/errors.i')
-rw-r--r-- | source4/libcli/util/errors.i | 11 |
1 files changed, 11 insertions, 0 deletions
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 |