ldb: Adjust to PY_SSIZE_T_CLEAN and use Py_ssize_t consistently with PyArg_ParseTuple*()
authorAndrew Bartlett <abartlet@samba.org>
Sun, 3 Jan 2016 23:42:06 +0000 (12:42 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 7 Jan 2016 22:33:10 +0000 (23:33 +0100)
This was inconsistent after dd7baa2ae2f98d5c1e82fa97f223925025da5ca0,
and may be the cause of test errors on s390x.  (The change to
py_ldb_dn_set_component() kept the Py_ssize_t type for 'size' without
setting the PY_SSIZE_T_CLEAN macro to have PyArg_ParseTuple() expect
a Py_ssize_t.  Instead, PyArg_ParseTuple() expected an int.

See in particular debian bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=808769

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
lib/ldb/pyldb.c

index fff1feee4da712a3755126ebd8cdc6679ef67874..3daed96f20d2b52d0325eada4518d39ee76922bc 100644 (file)
@@ -489,7 +489,7 @@ static PyObject *py_ldb_dn_set_extended_component(PyLdbDnObject *self, PyObject
        char *name;
        int err;
        uint8_t *value;
-       int size = 0;
+       Py_ssize_t size = 0;
 
        if (!PyArg_ParseTuple(args, "sz#", &name, (const char**)&value, &size))
                return NULL;
@@ -3642,7 +3642,7 @@ static PyObject *py_valid_attr_name(PyObject *self, PyObject *args)
 static PyObject *py_binary_encode(PyObject *self, PyObject *args)
 {
        char *str, *encoded;
-       int size = 0;
+       Py_ssize_t size = 0;
        struct ldb_val val;
        PyObject *ret;