pidl: Use PY_SSIZE_T_CLEAN
authorAndrew Bartlett <abartlet@samba.org>
Mon, 4 Jan 2016 00:03:39 +0000 (13:03 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 7 Jan 2016 22:33:10 +0000 (23:33 +0100)
This changes the type used for # arguments to PyArg_ParseTupleAndKeywords

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
pidl/lib/Parse/Pidl/Samba4/Python.pm

index 180b6b20089953641dc2d564556f99e6820e125f..82f9219574274d381bbd2715b5bf2436a97a1df1 100644 (file)
@@ -282,7 +282,7 @@ sub PythonStruct($$$$$$)
                $self->indent;
                $self->pidl("$cname *object = ($cname *)pytalloc_get_ptr(py_obj);");
                $self->pidl("DATA_BLOB blob;");
-               $self->pidl("int blob_length = 0;");
+               $self->pidl("Py_ssize_t blob_length = 0;");
                $self->pidl("enum ndr_err_code err;");
                $self->pidl("const char * const kwnames[] = { \"data_blob\", \"allow_remaining\", NULL };");
                $self->pidl("PyObject *allow_remaining_obj = NULL;");
@@ -1490,6 +1490,7 @@ sub Parse($$$$$)
 
     $self->pidl_hdr("
 /* Python wrapper functions auto-generated by pidl */
+#define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */
 #include <Python.h>
 #include \"includes.h\"
 #include <pytalloc.h>