[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Fri Jan 8 01:37:03 UTC 2016


The branch, master has been updated
       via  78e9f1e build: Add space before -D option
       via  0e58705 python: Remove Python 2.4 support macros
       via  8bac96d ntvfs/python: Adjust to use of PY_SSIZE_T_CLEAN
       via  516ec30 pyrpc: Adjust to use of PY_SSIZE_T_CLEAN
       via  5c7822a pyregistry: Adjust to use of PY_SSIZE_T_CLEAN
       via  6a6aec7 pymessaging: Adjust to use of PY_SSIZE_T_CLEAN
       via  0064f1d3 pylibsmb: Adjust to use of PY_SSIZE_T_CLEAN
       via  638c611 pidl: Use PY_SSIZE_T_CLEAN
       via  4894811 ldb: Adjust to PY_SSIZE_T_CLEAN and  use Py_ssize_t consistently with PyArg_ParseTuple*()
       via  46b8d7f python: Assert that we use Py_ssize_t consistently for PyParseArgs*()
      from  11de99a asn1: Clean up includes

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 78e9f1effb0d8f5fd4eb170ff44af428bc5c2315
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Jan 6 12:28:44 2016 +1300

    build: Add space before -D option
    
    This ensures that it is not concatonated with the previous option
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Jelmer Vernooij <jelmer at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Fri Jan  8 02:36:47 CET 2016 on sn-devel-144

commit 0e58705a5bc11a9556d0774f9cb2fbb3897839c8
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jan 4 13:23:50 2016 +1300

    python: Remove Python 2.4 support macros
    
    We require Python 2.6
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Jelmer Vernooij <jelmer at samba.org>

commit 8bac96de8265b82815276a14aaba3295d19845aa
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jan 4 13:07:49 2016 +1300

    ntvfs/python: Adjust to use of PY_SSIZE_T_CLEAN
    
    This changes the type used for # arguments to PyArg_ParseTuple
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Jelmer Vernooij <jelmer at samba.org>

commit 516ec3005a18770bceb25aa6e49799fe407ceff5
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jan 4 13:07:08 2016 +1300

    pyrpc: Adjust to use of PY_SSIZE_T_CLEAN
    
    This changes the type used for # arguments to PyArg_ParseTupleAndKeywords
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Jelmer Vernooij <jelmer at samba.org>

commit 5c7822a1e4e89a9f175c55b6e9913779452136c2
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jan 4 13:06:31 2016 +1300

    pyregistry: Adjust to use of PY_SSIZE_T_CLEAN
    
    This changes the type used for # arguments to PyArg_ParseTuple
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Jelmer Vernooij <jelmer at samba.org>

commit 6a6aec78c52fad1b6fdd92834444c29992142ce6
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jan 4 13:05:44 2016 +1300

    pymessaging: Adjust to use of PY_SSIZE_T_CLEAN
    
    This changes the type used for # arguments to PyArg_ParseTupleAndKeywords
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Jelmer Vernooij <jelmer at samba.org>

commit 0064f1d3a63ebb3f819f680a5e209d011ec43cc4
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jan 4 13:04:46 2016 +1300

    pylibsmb: Adjust to use of PY_SSIZE_T_CLEAN
    
    This changes the type used for # arguments to PyArg_ParseTupleAndKeywords
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Jelmer Vernooij <jelmer at samba.org>

commit 638c611796f6bb692e9a4500644d8875adc5c3c8
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jan 4 13:03:39 2016 +1300

    pidl: Use PY_SSIZE_T_CLEAN
    
    This changes the type used for # arguments to PyArg_ParseTupleAndKeywords
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Jelmer Vernooij <jelmer at samba.org>

commit 4894811dafafc57de98bf5271b3ee133622cefb6
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jan 4 12:42:06 2016 +1300

    ldb: Adjust to PY_SSIZE_T_CLEAN and  use Py_ssize_t consistently with PyArg_ParseTuple*()
    
    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 at samba.org>
    Reviewed-by: Jelmer Vernooij <jelmer at samba.org>

commit 46b8d7fc522f2fa084b56451ce3775e7138e2bca
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Jan 6 11:57:39 2016 +1300

    python: Assert that we use Py_ssize_t consistently for PyParseArgs*()
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Jelmer Vernooij <jelmer at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 buildtools/wafsamba/samba_python.py         | 13 ++++++++++++-
 lib/ldb/pyldb.c                             |  4 ++--
 pidl/lib/Parse/Pidl/Samba4/Python.pm        |  3 ++-
 source3/libsmb/pylibsmb.c                   |  2 +-
 source3/passdb/py_passdb.c                  |  7 -------
 source4/auth/pyauth.c                       |  7 -------
 source4/dsdb/pydsdb.c                       |  7 -------
 source4/lib/messaging/pymessaging.c         |  2 +-
 source4/lib/registry/pyregistry.c           |  2 +-
 source4/librpc/rpc/pyrpc.c                  |  2 +-
 source4/ntvfs/posix/python/pyposix_eadb.c   |  2 +-
 source4/ntvfs/posix/python/pyxattr_native.c |  2 +-
 source4/ntvfs/posix/python/pyxattr_tdb.c    |  2 +-
 source4/param/pyparam.c                     |  6 ------
 source4/web_server/wsgi.c                   |  7 -------
 15 files changed, 23 insertions(+), 45 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/samba_python.py b/buildtools/wafsamba/samba_python.py
index 8075381..057a017 100644
--- a/buildtools/wafsamba/samba_python.py
+++ b/buildtools/wafsamba/samba_python.py
@@ -97,7 +97,18 @@ def SAMBA_PYTHON(bld, name,
     # when we support static python modules we'll need to gather
     # the list from all the SAMBA_PYTHON() targets
     if init_function_sentinel is not None:
-        cflags += '-DSTATIC_LIBPYTHON_MODULES=%s' % init_function_sentinel
+        cflags += ' -DSTATIC_LIBPYTHON_MODULES=%s' % init_function_sentinel
+
+    # From https://docs.python.org/2/c-api/arg.html:
+    # Starting with Python 2.5 the type of the length argument to
+    # PyArg_ParseTuple(), PyArg_ParseTupleAndKeywords() and PyArg_Parse()
+    # can be controlled by defining the macro PY_SSIZE_T_CLEAN before
+    # including Python.h. If the macro is defined, length is a Py_ssize_t
+    # rather than an int.
+
+    # Because <Python.h> if often included before includes.h/config.h
+    # This must be in the -D compiler options
+    cflags += ' -DPY_SSIZE_T_CLEAN=1'
 
     source = bld.EXPAND_VARIABLES(source, vars=vars)
 
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c
index fff1fee..3daed96 100644
--- a/lib/ldb/pyldb.c
+++ b/lib/ldb/pyldb.c
@@ -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;
 
diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 180b6b2..82f9219 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -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>
diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c
index 2d6853a..0c5d7e9 100644
--- a/source3/libsmb/pylibsmb.c
+++ b/source3/libsmb/pylibsmb.c
@@ -650,7 +650,7 @@ static PyObject *py_cli_write(struct py_cli_state *self, PyObject *args,
 	int fnum;
 	unsigned mode = 0;
 	char *buf;
-	int buflen;
+	Py_ssize_t buflen;
 	unsigned long long offset;
 	struct tevent_req *req;
 	NTSTATUS status;
diff --git a/source3/passdb/py_passdb.c b/source3/passdb/py_passdb.c
index ca43f70..0d4ca3b 100644
--- a/source3/passdb/py_passdb.c
+++ b/source3/passdb/py_passdb.c
@@ -27,13 +27,6 @@
 #include "secrets.h"
 #include "idmap.h"
 
-/* There's no Py_ssize_t in 2.4, apparently */
-#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 5
-typedef int Py_ssize_t;
-typedef inquiry lenfunc;
-typedef intargfunc ssizeargfunc;
-#endif
-
 #ifndef Py_TYPE /* Py_TYPE is only available on Python > 2.6 */
 #define Py_TYPE(ob)             (((PyObject*)(ob))->ob_type)
 #endif
diff --git a/source4/auth/pyauth.c b/source4/auth/pyauth.c
index d79d417..37f19fa 100644
--- a/source4/auth/pyauth.c
+++ b/source4/auth/pyauth.c
@@ -36,13 +36,6 @@ void initauth(void);
 
 staticforward PyTypeObject PyAuthContext;
 
-/* There's no Py_ssize_t in 2.4, apparently */
-#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 5
-typedef int Py_ssize_t;
-typedef inquiry lenfunc;
-typedef intargfunc ssizeargfunc;
-#endif
-
 static PyObject *PyAuthSession_FromSession(struct auth_session_info *session)
 {
 	return py_return_ndr_struct("samba.dcerpc.auth", "session_info", session, session);
diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c
index 0a11e7b..8f36e8a 100644
--- a/source4/dsdb/pydsdb.c
+++ b/source4/dsdb/pydsdb.c
@@ -31,13 +31,6 @@
 
 void initdsdb(void);
 
-/* There's no Py_ssize_t in 2.4, apparently */
-#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 5
-typedef int Py_ssize_t;
-typedef inquiry lenfunc;
-typedef intargfunc ssizeargfunc;
-#endif
-
 /* FIXME: These should be in a header file somewhere */
 #define PyErr_LDB_OR_RAISE(py_ldb, ldb) \
 	if (!py_check_dcerpc_type(py_ldb, "ldb", "Ldb")) { \
diff --git a/source4/lib/messaging/pymessaging.c b/source4/lib/messaging/pymessaging.c
index 199532f..0eca139 100644
--- a/source4/lib/messaging/pymessaging.c
+++ b/source4/lib/messaging/pymessaging.c
@@ -147,7 +147,7 @@ static PyObject *py_imessaging_send(PyObject *self, PyObject *args, PyObject *kw
 	NTSTATUS status;
 	struct server_id server;
 	const char *kwnames[] = { "target", "msg_type", "data", NULL };
-	int length;
+	Py_ssize_t length;
 
 	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Ois#:send", 
 		discard_const_p(char *, kwnames), &target, &msg_type, &data.data, &length)) {
diff --git a/source4/lib/registry/pyregistry.c b/source4/lib/registry/pyregistry.c
index 8f96710..7b7fdf3 100644
--- a/source4/lib/registry/pyregistry.c
+++ b/source4/lib/registry/pyregistry.c
@@ -212,7 +212,7 @@ static PyObject *py_hive_key_set_value(PyObject *self, PyObject *args)
 	char *name;
 	uint32_t type;
 	DATA_BLOB value;
-	int value_length = 0;
+	Py_ssize_t value_length = 0;
 	WERROR result;
 	struct hive_key *key = PyHiveKey_AsHiveKey(self);
 
diff --git a/source4/librpc/rpc/pyrpc.c b/source4/librpc/rpc/pyrpc.c
index 243e96b..f1bfc88 100644
--- a/source4/librpc/rpc/pyrpc.c
+++ b/source4/librpc/rpc/pyrpc.c
@@ -200,7 +200,7 @@ static PyObject *py_iface_request(PyObject *self, PyObject *args, PyObject *kwar
 	DATA_BLOB data_in, data_out;
 	NTSTATUS status;
 	char *in_data;
-	int in_length;
+	Py_ssize_t in_length;
 	PyObject *ret;
 	PyObject *object = NULL;
 	struct GUID object_guid;
diff --git a/source4/ntvfs/posix/python/pyposix_eadb.c b/source4/ntvfs/posix/python/pyposix_eadb.c
index db62baf..a94440b 100644
--- a/source4/ntvfs/posix/python/pyposix_eadb.c
+++ b/source4/ntvfs/posix/python/pyposix_eadb.c
@@ -39,7 +39,7 @@ static PyObject *py_wrap_setxattr(PyObject *self, PyObject *args)
 {
 	char *filename, *attribute, *tdbname;
 	DATA_BLOB blob;
-	int blobsize;
+	Py_ssize_t blobsize;
 	NTSTATUS status;
 	TALLOC_CTX *mem_ctx;
 	struct tdb_wrap *eadb;
diff --git a/source4/ntvfs/posix/python/pyxattr_native.c b/source4/ntvfs/posix/python/pyxattr_native.c
index 6ddfe08..8dd98d2 100644
--- a/source4/ntvfs/posix/python/pyxattr_native.c
+++ b/source4/ntvfs/posix/python/pyxattr_native.c
@@ -38,7 +38,7 @@ static PyObject *py_wrap_setxattr(PyObject *self, PyObject *args)
 {
 	char *filename, *attribute;
 	int ret = 0;
-	int blobsize;
+	Py_ssize_t blobsize;
 	DATA_BLOB blob;
 
 	if (!PyArg_ParseTuple(args, "sss#", &filename, &attribute, &blob.data, 
diff --git a/source4/ntvfs/posix/python/pyxattr_tdb.c b/source4/ntvfs/posix/python/pyxattr_tdb.c
index ef3401c..56beedb 100644
--- a/source4/ntvfs/posix/python/pyxattr_tdb.c
+++ b/source4/ntvfs/posix/python/pyxattr_tdb.c
@@ -43,7 +43,7 @@ static PyObject *py_wrap_setxattr(PyObject *self, PyObject *args)
 {
 	char *filename, *attribute, *tdbname;
 	DATA_BLOB blob;
-	int blobsize;
+	Py_ssize_t blobsize;
 	int ret;
 	TALLOC_CTX *mem_ctx;
 	struct loadparm_context *lp_ctx;
diff --git a/source4/param/pyparam.c b/source4/param/pyparam.c
index 14ffb2d..d1ba009 100644
--- a/source4/param/pyparam.c
+++ b/source4/param/pyparam.c
@@ -26,12 +26,6 @@
 
 void initparam(void);
 
-/* There's no Py_ssize_t in 2.4, apparently */
-#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 5
-typedef int Py_ssize_t;
-typedef inquiry lenfunc;
-#endif
-
 #define PyLoadparmContext_AsLoadparmContext(obj) pytalloc_get_type(obj, struct loadparm_context)
 #define PyLoadparmService_AsLoadparmService(obj) pytalloc_get_type(obj, struct loadparm_service)
 
diff --git a/source4/web_server/wsgi.c b/source4/web_server/wsgi.c
index f0e7bd5..0b1c5d2 100644
--- a/source4/web_server/wsgi.c
+++ b/source4/web_server/wsgi.c
@@ -28,13 +28,6 @@
 #include "lib/tsocket/tsocket.h"
 #include "python/modules.h"
 
-/* There's no Py_ssize_t in 2.4, apparently */
-#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 5
-typedef int Py_ssize_t;
-typedef inquiry lenfunc;
-typedef intargfunc ssizeargfunc;
-#endif
-
 typedef struct {
 	PyObject_HEAD
 	struct websrv_context *web;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list