[SCM] Samba Shared Repository - branch master updated

Noel Power npower at samba.org
Mon Mar 23 20:48:02 UTC 2020


The branch, master has been updated
       via  1114b02a72c s3: libsmbclient.h: add missing time.h include
       via  4d65e3ad210 s4-librpc: Simplify bytes or unicode input checking in python GUID() bindings
       via  a7633deb897 py3: Remove #define IsPy3BytesOrString(pystr)
       via  675ab9d6ae6 py3: Remove #define IsPy3Bytes PyBytes_Check
       via  5c1867ba459 py3: Remove #define PyInt_FromLong PyLong_FromLong
       via  4764e8b4c7e py3: Remove #define PyInt_AsLong PyLong_AsLong
       via  cc79726d951 py3: Remove #define PyInt_Type PyLong_Type
       via  08a76ec0963 pidl: Remove reference to PyInt_Type from error string when we wanted a sensible Long
       via  79044e966cb pidl: Remove duplicate "if (PyLong_Check($cvar)" clauses
       via  3aea3b15381 py3: Remove #define PyInt_Check PyLong_Check
      from  9bdc5a67428 autobuild: Merge samba-simpleserver into samba-nt4

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


- Log -----------------------------------------------------------------
commit 1114b02a72ce0c86a5301816560d270ec47f8be3
Author: Aurelien Aptel <aaptel at suse.com>
Date:   Fri Mar 13 13:42:53 2020 +0100

    s3: libsmbclient.h: add missing time.h include
    
    A recent change added a struct with timespec members in the public
    libsmbclient header. This type is defined in time.h which was not
    included thus making users of libsmbclient not build properly.
    
        /.../libsmbclient.h:158:18: error: field 'btime_ts' has incomplete type
          struct timespec btime_ts;
    
    Fixes: bf13fe0f222 ("s3: libsmbclient: Add internal/external structures needed for readdirplus.")
    Signed-off-by: Aurelien Aptel <aaptel at suse.com>
    Reviewed-by: Noel Power <npower at samba.org>
    
    Autobuild-User(master): Noel Power <npower at samba.org>
    Autobuild-Date(master): Mon Mar 23 20:47:44 UTC 2020 on sn-devel-184

commit 4d65e3ad2104773b361afd35d3b8b8b7e598f91f
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sun Mar 15 10:47:32 2020 +1300

    s4-librpc: Simplify bytes or unicode input checking in python GUID() bindings
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Noel Power <npower at samba.org>

commit a7633deb8978e2417430692223047283baf30147
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sun Mar 15 10:43:16 2020 +1300

    py3: Remove #define IsPy3BytesOrString(pystr)
    
    This was
    
      (PyUnicode_Check(pystr) || PyBytes_Check(pystr))
    
    This allows us to end the use of Python 2/3 compatability macros.
    
    The one caller will be simplified in the next commit
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Noel Power <nopower at samba.org>

commit 675ab9d6ae6f5cd95ddde51d19774cae7ecc11ca
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sun Mar 15 10:40:46 2020 +1300

    py3: Remove #define IsPy3Bytes PyBytes_Check
    
    This allows us to end the use of Python 2/3 compatability macros.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Noel Power <npower at samba.org>

commit 5c1867ba459c2eff0dfc99c92200aecc2d44df59
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sun Mar 15 10:36:59 2020 +1300

    py3: Remove #define PyInt_FromLong PyLong_FromLong
    
    This allows us to end the use of Python 2/3 compatability macros.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Noel Power

commit 4764e8b4c7e459f6aa5861d26ffaec3a3026d77f
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sun Mar 15 10:32:11 2020 +1300

    py3: Remove #define PyInt_AsLong PyLong_AsLong
    
    This allows us to end the use of Python 2/3 compatability macros.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Noel Power <npower at samba.org>

commit cc79726d95108e3d8ef612a863c2f9fffd768636
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sun Mar 15 10:26:22 2020 +1300

    py3: Remove #define PyInt_Type PyLong_Type
    
    This allows us to end the use of Python 2/3 compatability macros.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Noel Power <npower at samba.org>

commit 08a76ec0963049e0f2b8f855ab66ba5141472fce
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sun Mar 15 10:15:15 2020 +1300

    pidl: Remove reference to PyInt_Type from error string when we wanted a sensible Long
    
    PyInt_Type is no longer a thing in Python3, we will remove the compatability
    reference shortly.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Noel Power <npower at samba.org>

commit 79044e966cbe44d60997ecbd4b44f07305d99ac2
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sun Mar 15 10:10:24 2020 +1300

    pidl: Remove duplicate "if (PyLong_Check($cvar)" clauses
    
    Since we moved to Python3, these have been dead code, and it is clearer
    now that we have removed the compatability define.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Noel Power <npower at samba.org>

commit 3aea3b15381857bf3e9a69477c487c91f1b6cbbd
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sun Mar 15 10:04:52 2020 +1300

    py3: Remove #define PyInt_Check PyLong_Check
    
    This will allow us to remove some unused code in the PIDL-generated
    python bindings.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Noel Power <npower at samba.org>

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

Summary of changes:
 auth/credentials/pycredentials.c     |  44 +++++++-------
 lib/ldb/pyldb.c                      |   7 +--
 lib/tdb/pytdb.c                      |  17 +++---
 lib/tevent/pytevent.c                |   4 +-
 libcli/nbt/pynbt.c                   |  12 ++--
 libcli/security/pysecurity.c         |   2 +-
 pidl/lib/Parse/Pidl/Samba4/Python.pm |  54 +++++------------
 python/py3compat.h                   |  22 -------
 python/pyglue.c                      |   6 +-
 source3/include/libsmbclient.h       |   1 +
 source3/libsmb/pylibsmb.c            |   4 +-
 source3/passdb/py_passdb.c           | 114 +++++++++++++++++------------------
 source4/auth/gensec/pygensec.c       |  18 +++---
 source4/dsdb/pydsdb.c                |   8 +--
 source4/lib/messaging/pymessaging.c  |   4 +-
 source4/lib/policy/pypolicy.c        |   8 +--
 source4/lib/registry/pyregistry.c    |  18 +++---
 source4/lib/wmi/wmi.i                |   4 +-
 source4/lib/wmi/wmi_wrap.c           |  22 +++----
 source4/librpc/ndr/py_misc.c         |  13 ++--
 source4/librpc/ndr/py_security.c     |   2 +-
 source4/librpc/rpc/pyrpc.c           |   4 +-
 source4/param/provision.c            |   8 +--
 source4/param/pyparam.c              |   2 +-
 24 files changed, 173 insertions(+), 225 deletions(-)


Changeset truncated at 500 lines:

diff --git a/auth/credentials/pycredentials.c b/auth/credentials/pycredentials.c
index 7427e286dca..fad07b84ba7 100644
--- a/auth/credentials/pycredentials.c
+++ b/auth/credentials/pycredentials.c
@@ -556,7 +556,7 @@ static PyObject *py_creds_get_kerberos_state(PyObject *self, PyObject *unused)
 		return NULL;
 	}
 	state = cli_credentials_get_kerberos_state(creds);
-	return PyInt_FromLong(state);
+	return PyLong_FromLong(state);
 }
 
 static PyObject *py_creds_set_kerberos_state(PyObject *self, PyObject *args)
@@ -822,7 +822,7 @@ static PyObject *py_creds_get_gensec_features(PyObject *self, PyObject *args)
 	}
 
 	gensec_features = cli_credentials_get_gensec_features(creds);
-	return PyInt_FromLong(gensec_features);
+	return PyLong_FromLong(gensec_features);
 }
 
 static PyObject *py_creds_new_client_authenticator(PyObject *self,
@@ -893,7 +893,7 @@ static PyObject *py_creds_get_secure_channel_type(PyObject *self, PyObject *args
 
 	channel_type = cli_credentials_get_secure_channel_type(creds);
 
-	return PyInt_FromLong(channel_type);
+	return PyLong_FromLong(channel_type);
 }
 
 static PyObject *py_creds_encrypt_netr_crypt_password(PyObject *self,
@@ -1274,25 +1274,25 @@ MODULE_INIT_FUNC(credentials)
 	if (m == NULL)
 		return NULL;
 
-	PyModule_AddObject(m, "UNINITIALISED", PyInt_FromLong(CRED_UNINITIALISED));
-	PyModule_AddObject(m, "CALLBACK", PyInt_FromLong(CRED_CALLBACK));
-	PyModule_AddObject(m, "GUESS_ENV", PyInt_FromLong(CRED_GUESS_ENV));
-	PyModule_AddObject(m, "GUESS_FILE", PyInt_FromLong(CRED_GUESS_FILE));
-	PyModule_AddObject(m, "CALLBACK_RESULT", PyInt_FromLong(CRED_CALLBACK_RESULT));
-	PyModule_AddObject(m, "SPECIFIED", PyInt_FromLong(CRED_SPECIFIED));
-
-	PyModule_AddObject(m, "AUTO_USE_KERBEROS", PyInt_FromLong(CRED_AUTO_USE_KERBEROS));
-	PyModule_AddObject(m, "DONT_USE_KERBEROS", PyInt_FromLong(CRED_DONT_USE_KERBEROS));
-	PyModule_AddObject(m, "MUST_USE_KERBEROS", PyInt_FromLong(CRED_MUST_USE_KERBEROS));
-
-	PyModule_AddObject(m, "AUTO_KRB_FORWARDABLE",  PyInt_FromLong(CRED_AUTO_KRB_FORWARDABLE));
-	PyModule_AddObject(m, "NO_KRB_FORWARDABLE",    PyInt_FromLong(CRED_NO_KRB_FORWARDABLE));
-	PyModule_AddObject(m, "FORCE_KRB_FORWARDABLE", PyInt_FromLong(CRED_FORCE_KRB_FORWARDABLE));
-	PyModule_AddObject(m, "CLI_CRED_NTLM2", PyInt_FromLong(CLI_CRED_NTLM2));
-	PyModule_AddObject(m, "CLI_CRED_NTLMv2_AUTH", PyInt_FromLong(CLI_CRED_NTLMv2_AUTH));
-	PyModule_AddObject(m, "CLI_CRED_LANMAN_AUTH", PyInt_FromLong(CLI_CRED_LANMAN_AUTH));
-	PyModule_AddObject(m, "CLI_CRED_NTLM_AUTH", PyInt_FromLong(CLI_CRED_NTLM_AUTH));
-	PyModule_AddObject(m, "CLI_CRED_CLEAR_AUTH", PyInt_FromLong(CLI_CRED_CLEAR_AUTH));
+	PyModule_AddObject(m, "UNINITIALISED", PyLong_FromLong(CRED_UNINITIALISED));
+	PyModule_AddObject(m, "CALLBACK", PyLong_FromLong(CRED_CALLBACK));
+	PyModule_AddObject(m, "GUESS_ENV", PyLong_FromLong(CRED_GUESS_ENV));
+	PyModule_AddObject(m, "GUESS_FILE", PyLong_FromLong(CRED_GUESS_FILE));
+	PyModule_AddObject(m, "CALLBACK_RESULT", PyLong_FromLong(CRED_CALLBACK_RESULT));
+	PyModule_AddObject(m, "SPECIFIED", PyLong_FromLong(CRED_SPECIFIED));
+
+	PyModule_AddObject(m, "AUTO_USE_KERBEROS", PyLong_FromLong(CRED_AUTO_USE_KERBEROS));
+	PyModule_AddObject(m, "DONT_USE_KERBEROS", PyLong_FromLong(CRED_DONT_USE_KERBEROS));
+	PyModule_AddObject(m, "MUST_USE_KERBEROS", PyLong_FromLong(CRED_MUST_USE_KERBEROS));
+
+	PyModule_AddObject(m, "AUTO_KRB_FORWARDABLE",  PyLong_FromLong(CRED_AUTO_KRB_FORWARDABLE));
+	PyModule_AddObject(m, "NO_KRB_FORWARDABLE",    PyLong_FromLong(CRED_NO_KRB_FORWARDABLE));
+	PyModule_AddObject(m, "FORCE_KRB_FORWARDABLE", PyLong_FromLong(CRED_FORCE_KRB_FORWARDABLE));
+	PyModule_AddObject(m, "CLI_CRED_NTLM2", PyLong_FromLong(CLI_CRED_NTLM2));
+	PyModule_AddObject(m, "CLI_CRED_NTLMv2_AUTH", PyLong_FromLong(CLI_CRED_NTLMv2_AUTH));
+	PyModule_AddObject(m, "CLI_CRED_LANMAN_AUTH", PyLong_FromLong(CLI_CRED_LANMAN_AUTH));
+	PyModule_AddObject(m, "CLI_CRED_NTLM_AUTH", PyLong_FromLong(CLI_CRED_NTLM_AUTH));
+	PyModule_AddObject(m, "CLI_CRED_CLEAR_AUTH", PyLong_FromLong(CLI_CRED_CLEAR_AUTH));
 
 	Py_INCREF(&PyCredentials);
 	PyModule_AddObject(m, "Credentials", (PyObject *)&PyCredentials);
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c
index a6069be46a9..eb879b98984 100644
--- a/lib/ldb/pyldb.c
+++ b/lib/ldb/pyldb.c
@@ -85,7 +85,6 @@ static struct ldb_message_element *PyObject_AsMessageElement(
 static PyTypeObject PyLdbBytesType;
 
 #if PY_MAJOR_VERSION >= 3
-#define PyInt_FromLong PyLong_FromLong
 
 #define PYARG_STR_UNI "es"
 
@@ -2541,7 +2540,7 @@ static PyObject *py_ldb_result_get_count(PyLdbResultObject *self, void *closure)
 		return NULL;
 	}
 	size = PyList_Size(self->msgs);
-	return PyInt_FromLong(size);
+	return PyLong_FromLong(size);
 }
 
 static PyGetSetDef py_ldb_result_getset[] = {
@@ -3080,7 +3079,7 @@ static PyObject *py_ldb_msg_element_get(PyLdbMessageElementObject *self, PyObjec
 static PyObject *py_ldb_msg_element_flags(PyLdbMessageElementObject *self, PyObject *args)
 {
 	struct ldb_message_element *el = pyldb_MessageElement_AsMessageElement(self);
-	return PyInt_FromLong(el->flags);
+	return PyLong_FromLong(el->flags);
 }
 
 static PyObject *py_ldb_msg_element_set_flags(PyLdbMessageElementObject *self, PyObject *args)
@@ -4204,7 +4203,7 @@ static PyObject *py_string_to_time(PyObject *module, PyObject *args)
 	if (!PyArg_ParseTuple(args, "s", &str))
 		return NULL;
 
-	return PyInt_FromLong(ldb_string_to_time(str));
+	return PyLong_FromLong(ldb_string_to_time(str));
 }
 
 static PyObject *py_valid_attr_name(PyObject *self, PyObject *args)
diff --git a/lib/tdb/pytdb.c b/lib/tdb/pytdb.c
index 74e80f95ec5..5ff1ef83117 100644
--- a/lib/tdb/pytdb.c
+++ b/lib/tdb/pytdb.c
@@ -32,9 +32,6 @@
 #include <tdb.h>
 
 #if PY_MAJOR_VERSION >= 3
-#define PyInt_FromLong PyLong_FromLong
-#define PyInt_Check PyLong_Check
-#define PyInt_AsLong PyLong_AsLong
 #define Py_TPFLAGS_HAVE_ITER 0
 #endif
 
@@ -549,34 +546,34 @@ static PyMethodDef tdb_object_methods[] = {
 static PyObject *obj_get_hash_size(PyTdbObject *self, void *closure)
 {
 	PyErr_TDB_RAISE_IF_CLOSED(self);
-	return PyInt_FromLong(tdb_hash_size(self->ctx));
+	return PyLong_FromLong(tdb_hash_size(self->ctx));
 }
 
 static int obj_set_max_dead(PyTdbObject *self, PyObject *max_dead, void *closure)
 {
 	PyErr_TDB_RAISE_RETURN_MINUS_1_IF_CLOSED(self);
-	if (!PyInt_Check(max_dead))
+	if (!PyLong_Check(max_dead))
 		return -1;
-	tdb_set_max_dead(self->ctx, PyInt_AsLong(max_dead));
+	tdb_set_max_dead(self->ctx, PyLong_AsLong(max_dead));
 	return 0;
 }
 
 static PyObject *obj_get_map_size(PyTdbObject *self, void *closure)
 {
 	PyErr_TDB_RAISE_IF_CLOSED(self);
-	return PyInt_FromLong(tdb_map_size(self->ctx));
+	return PyLong_FromLong(tdb_map_size(self->ctx));
 }
 
 static PyObject *obj_get_freelist_size(PyTdbObject *self, void *closure)
 {
 	PyErr_TDB_RAISE_IF_CLOSED(self);
-	return PyInt_FromLong(tdb_freelist_size(self->ctx));
+	return PyLong_FromLong(tdb_freelist_size(self->ctx));
 }
 
 static PyObject *obj_get_flags(PyTdbObject *self, void *closure)
 {
 	PyErr_TDB_RAISE_IF_CLOSED(self);
-	return PyInt_FromLong(tdb_get_flags(self->ctx));
+	return PyLong_FromLong(tdb_get_flags(self->ctx));
 }
 
 static PyObject *obj_get_filename(PyTdbObject *self, void *closure)
@@ -588,7 +585,7 @@ static PyObject *obj_get_filename(PyTdbObject *self, void *closure)
 static PyObject *obj_get_seqnum(PyTdbObject *self, void *closure)
 {
 	PyErr_TDB_RAISE_IF_CLOSED(self);
-	return PyInt_FromLong(tdb_get_seqnum(self->ctx));
+	return PyLong_FromLong(tdb_get_seqnum(self->ctx));
 }
 
 static PyObject *obj_get_text(PyTdbObject *self, void *closure)
diff --git a/lib/tevent/pytevent.c b/lib/tevent/pytevent.c
index 73a9bd736e7..dde6bd010c7 100644
--- a/lib/tevent/pytevent.c
+++ b/lib/tevent/pytevent.c
@@ -27,7 +27,7 @@
 #include <tevent.h>
 
 #if PY_MAJOR_VERSION >= 3
-#define PyInt_FromLong PyLong_FromLong
+#define PyLong_FromLong PyLong_FromLong
 #endif
 
 /* discard signature of 'func' in favour of 'target_sig' */
@@ -709,7 +709,7 @@ static PyTypeObject TeventReq_Type = {
 static PyObject *py_tevent_queue_get_length(TeventQueue_Object *self,
 			PyObject *Py_UNUSED(ignored))
 {
-	return PyInt_FromLong(tevent_queue_length(self->queue));
+	return PyLong_FromLong(tevent_queue_length(self->queue));
 }
 
 static PyGetSetDef py_tevent_queue_getsetters[] = {
diff --git a/libcli/nbt/pynbt.c b/libcli/nbt/pynbt.c
index a562f6dcb5e..d8a781b5290 100644
--- a/libcli/nbt/pynbt.c
+++ b/libcli/nbt/pynbt.c
@@ -79,8 +79,8 @@ static bool PyObject_AsDestinationTuple(PyObject *obj, const char **dest_addr, u
 		if (PyTuple_Size(obj) == 1) {
 			*dest_port = NBT_NAME_SERVICE_PORT;
 			return true;
-		} else if (PyInt_Check(PyTuple_GetItem(obj, 1))) {
-			*dest_port = PyInt_AsLong(PyTuple_GetItem(obj, 1));
+		} else if (PyLong_Check(PyTuple_GetItem(obj, 1))) {
+			*dest_port = PyLong_AsLong(PyTuple_GetItem(obj, 1));
 			return true;
 		} else {
 			PyErr_SetString(PyExc_TypeError, "Destination tuple second element not a port");
@@ -100,7 +100,7 @@ static bool PyObject_AsNBTName(PyObject *obj, struct nbt_name_socket *name_socke
 			if (name->name == NULL) {
 				goto err;
 			}
-			name->type = PyInt_AsLong(PyTuple_GetItem(obj, 1));
+			name->type = PyLong_AsLong(PyTuple_GetItem(obj, 1));
 			if (name->type == -1 && PyErr_Occurred()) {
 				goto err;
 			}
@@ -115,7 +115,7 @@ static bool PyObject_AsNBTName(PyObject *obj, struct nbt_name_socket *name_socke
 			if (name->scope == NULL) {
 				goto err;
 			}
-			name->type = PyInt_AsLong(PyTuple_GetItem(obj, 2));
+			name->type = PyLong_AsLong(PyTuple_GetItem(obj, 2));
 			if (name->type == -1 && PyErr_Occurred()) {
 				goto err;
 			}
@@ -322,7 +322,7 @@ static PyObject *py_nbt_name_register(PyObject *self, PyObject *args, PyObject *
 
 	PyTuple_SetItem(ret, 2, PyUnicode_FromString(io.out.reply_addr));
 
-	PyTuple_SetItem(ret, 3, PyInt_FromLong(io.out.rcode));
+	PyTuple_SetItem(ret, 3, PyLong_FromLong(io.out.rcode));
 
 	return ret;
 }
@@ -378,7 +378,7 @@ static PyObject *py_nbt_name_refresh(PyObject *self, PyObject *args, PyObject *k
 
 	PyTuple_SetItem(ret, 2, PyUnicode_FromString(io.out.reply_addr));
 
-	PyTuple_SetItem(ret, 3, PyInt_FromLong(io.out.rcode));
+	PyTuple_SetItem(ret, 3, PyLong_FromLong(io.out.rcode));
 
 	return ret;
 }
diff --git a/libcli/security/pysecurity.c b/libcli/security/pysecurity.c
index fcef6007d54..9f4aa147c6a 100644
--- a/libcli/security/pysecurity.c
+++ b/libcli/security/pysecurity.c
@@ -65,7 +65,7 @@ static PyObject *py_se_access_check(PyObject *module, PyObject *args, PyObject *
 		PyErr_NTSTATUS_IS_ERR_RAISE(nt_status);
 	}
 
-	return PyInt_FromLong(access_granted);
+	return PyLong_FromLong(access_granted);
 }
 
 static PyMethodDef py_security_methods[] = {
diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 84d4dade512..12ddd046062 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -538,7 +538,7 @@ sub PythonFunctionStruct($$$$)
 	$self->indent;
 	$self->pidl("");
 	$self->pidl("");
-	$self->pidl("return PyInt_FromLong($fn->{OPNUM});");
+	$self->pidl("return PyLong_FromLong($fn->{OPNUM});");
 	$self->deindent;
 	$self->pidl("}");
 	$self->pidl("");
@@ -1747,21 +1747,8 @@ sub ConvertObjectFromPythonData($$$$$$;$$)
 		$self->pidl("}");
 		$self->pidl("if (test_var > uint_max) {");
 		$self->indent;
-		$self->pidl("PyErr_Format(PyExc_OverflowError, \"Expected type %s or %s within range 0 - %llu, got %llu\",\\");
-		$self->pidl("  PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);");
-		$self->pidl($fail);
-		$self->deindent;
-		$self->pidl("}");
-		$self->pidl("$target = test_var;");
-		$self->deindent;
-		$self->pidl("} else if (PyInt_Check($cvar)) {");
-		$self->indent;
-		$self->pidl("long test_var;");
-		$self->pidl("test_var = PyInt_AsLong($cvar);");
-		$self->pidl("if (test_var < 0 || (unsigned long long)test_var > uint_max) {");
-		$self->indent;
-		$self->pidl("PyErr_Format(PyExc_OverflowError, \"Expected type %s or %s within range 0 - %llu, got %ld\",\\");
-		$self->pidl("  PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);");
+		$self->pidl("PyErr_Format(PyExc_OverflowError, \"Expected type %s within range 0 - %llu, got %llu\",\\");
+		$self->pidl("  PyLong_Type.tp_name, uint_max, test_var);");
 		$self->pidl($fail);
 		$self->deindent;
 		$self->pidl("}");
@@ -1769,8 +1756,8 @@ sub ConvertObjectFromPythonData($$$$$$;$$)
 		$self->deindent;
 		$self->pidl("} else {");
 		$self->indent;
-		$self->pidl("PyErr_Format(PyExc_TypeError, \"Expected type %s or %s\",\\");
-		$self->pidl("  PyInt_Type.tp_name, PyLong_Type.tp_name);");
+		$self->pidl("PyErr_Format(PyExc_TypeError, \"Expected type %s\",\\");
+		$self->pidl("  PyLong_Type.tp_name);");
 		$self->pidl($fail);
 		$self->deindent;
 		$self->pidl("}");
@@ -1799,21 +1786,8 @@ sub ConvertObjectFromPythonData($$$$$$;$$)
 		$self->pidl("}");
 		$self->pidl("if (test_var < int_min || test_var > int_max) {");
 		$self->indent;
-		$self->pidl("PyErr_Format(PyExc_OverflowError, \"Expected type %s or %s within range %lld - %lld, got %lld\",\\");
-		$self->pidl("  PyInt_Type.tp_name, PyLong_Type.tp_name, int_min, int_max, test_var);");
-		$self->pidl($fail);
-		$self->deindent;
-		$self->pidl("}");
-		$self->pidl("$target = test_var;");
-		$self->deindent;
-		$self->pidl("} else if (PyInt_Check($cvar)) {");
-		$self->indent;
-		$self->pidl("long test_var;");
-		$self->pidl("test_var = PyInt_AsLong($cvar);");
-		$self->pidl("if (test_var < int_min || test_var > int_max) {");
-		$self->indent;
-		$self->pidl("PyErr_Format(PyExc_OverflowError, \"Expected type %s or %s within range %lld - %lld, got %ld\",\\");
-		$self->pidl("  PyInt_Type.tp_name, PyLong_Type.tp_name, int_min, int_max, test_var);");
+		$self->pidl("PyErr_Format(PyExc_OverflowError, \"Expected type %s within range %lld - %lld, got %lld\",\\");
+		$self->pidl("  PyLong_Type.tp_name, int_min, int_max, test_var);");
 		$self->pidl($fail);
 		$self->deindent;
 		$self->pidl("}");
@@ -1821,8 +1795,8 @@ sub ConvertObjectFromPythonData($$$$$$;$$)
 		$self->deindent;
 		$self->pidl("} else {");
 		$self->indent;
-		$self->pidl("PyErr_Format(PyExc_TypeError, \"Expected type %s or %s\",\\");
-		$self->pidl("  PyInt_Type.tp_name, PyLong_Type.tp_name);");
+		$self->pidl("PyErr_Format(PyExc_TypeError, \"Expected type %s\",\\");
+		$self->pidl("  PyLong_Type.tp_name);");
 		$self->pidl($fail);
 		$self->deindent;
 		$self->pidl("}");
@@ -1882,17 +1856,17 @@ sub ConvertObjectFromPythonData($$$$$$;$$)
 	}
 
 	if ($actual_ctype->{TYPE} eq "SCALAR" and $actual_ctype->{NAME} eq "NTSTATUS") {
-		$self->pidl("$target = NT_STATUS(PyInt_AsLong($cvar));");
+		$self->pidl("$target = NT_STATUS(PyLong_AsLong($cvar));");
 		return;
 	}
 
 	if ($actual_ctype->{TYPE} eq "SCALAR" and $actual_ctype->{NAME} eq "WERROR") {
-		$self->pidl("$target = W_ERROR(PyInt_AsLong($cvar));");
+		$self->pidl("$target = W_ERROR(PyLong_AsLong($cvar));");
 		return;
 	}
 
 	if ($actual_ctype->{TYPE} eq "SCALAR" and $actual_ctype->{NAME} eq "HRESULT") {
-		$self->pidl("$target = HRES_ERROR(PyInt_AsLong($cvar));");
+		$self->pidl("$target = HRES_ERROR(PyLong_AsLong($cvar));");
 		return;
 	}
 
@@ -2065,7 +2039,7 @@ sub ConvertScalarToPython($$$$)
 	}
 
 	if ($ctypename =~ /^(char|int|int8|int16|int32|time_t)$/) {
-		return "PyInt_FromLong($cvar)";
+		return "PyLong_FromLong($cvar)";
 	}
 
 	# Needed to ensure unsigned values in a 32 or 16 bit enum is
@@ -2077,7 +2051,7 @@ sub ConvertScalarToPython($$$$)
 	}
 
 	if ($ctypename =~ /^(uint|uint8|uint16|uint1632)$/) {
-		return "PyInt_FromLong((uint16_t)$cvar)";
+		return "PyLong_FromLong((uint16_t)$cvar)";
 	}
 
 	if ($ctypename eq "DATA_BLOB") {
diff --git a/python/py3compat.h b/python/py3compat.h
index d2adb24c6a2..d09947bf90d 100644
--- a/python/py3compat.h
+++ b/python/py3compat.h
@@ -29,8 +29,6 @@
  * "PyBytes_*" work like in Python 3; on Python 2 they are aliased to their
  * PyString_* names.
  *
- * "PyInt_*" works like PyLong_*
- *
  * Syntax for module initialization is as in Python 3, except the entrypoint
  * function definition and declaration:
  *     PyMODINIT_FUNC PyInit_modulename(void);
@@ -57,26 +55,6 @@
 /* description of bytes objects */
 #define PY_DESC_PY3_BYTES "bytes"
 
-/* Determine if object is really bytes, for code that runs
- * in python2 & python3 (note: PyBytes_Check is replaced by
- * PyString_Check in python2) so care needs to be taken when
- * writing code that will check if incoming type is bytes that
- * will work as expected in python2 & python3
- */
-
-#define IsPy3Bytes PyBytes_Check
-
-#define IsPy3BytesOrString(pystr) \
-    (PyUnicode_Check(pystr) || PyBytes_Check(pystr))
-
-
-/* Ints */
-
-#define PyInt_Type PyLong_Type
-#define PyInt_Check PyLong_Check
-#define PyInt_FromLong PyLong_FromLong
-#define PyInt_AsLong PyLong_AsLong
-
 /* Module init */
 
 #define MODULE_INIT_FUNC(name) \
diff --git a/python/pyglue.c b/python/pyglue.c
index 83b968bad8c..ef1419fbd88 100644
--- a/python/pyglue.c
+++ b/python/pyglue.c
@@ -131,7 +131,7 @@ static PyObject *py_nttime2unix(PyObject *self, PyObject *args)
 
 	t = nt_time_to_unix(nt);
 
-	return PyInt_FromLong((uint64_t)t);
+	return PyLong_FromLong((uint64_t)t);
 }
 
 static PyObject *py_nttime2string(PyObject *self, PyObject *args)
@@ -169,7 +169,7 @@ static PyObject *py_set_debug_level(PyObject *self, PyObject *args)
 static PyObject *py_get_debug_level(PyObject *self,
 		PyObject *Py_UNUSED(ignored))
 {
-	return PyInt_FromLong(debuglevel_get());
+	return PyLong_FromLong(debuglevel_get());
 }
 
 static PyObject *py_fault_setup(PyObject *self,
@@ -314,7 +314,7 @@ static PyObject *py_strcasecmp_m(PyObject *self, PyObject *args)
 	cmp_result = strcasecmp_m(s1, s2);
 	PyMem_Free(discard_const_p(char, s1));
 	PyMem_Free(discard_const_p(char, s2));
-	return PyInt_FromLong(cmp_result);
+	return PyLong_FromLong(cmp_result);
 }
 
 static PyObject *py_strstr_m(PyObject *self, PyObject *args)
diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h
index 5846550eb29..c47e7c2a872 100644
--- a/source3/include/libsmbclient.h
+++ b/source3/include/libsmbclient.h
@@ -78,6 +78,7 @@ extern "C" {
 #include <sys/statvfs.h>
 #include <stdint.h>
 #include <fcntl.h>
+#include <time.h>
 #include <utime.h>
 
 #define SMBC_BASE_FD        10000 /* smallest file descriptor returned */
diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c
index c09df917251..e61ca5c1993 100644
--- a/source3/libsmb/pylibsmb.c
+++ b/source3/libsmb/pylibsmb.c
@@ -682,7 +682,7 @@ static PyObject *py_cli_settimeout(struct py_cli_state *self, PyObject *args)
 
 	omsecs = cli_set_timeout(self->cli, nmsecs);
 
-	return PyInt_FromLong(omsecs);
+	return PyLong_FromLong(omsecs);
 }
 
 static PyObject *py_cli_create(struct py_cli_state *self, PyObject *args,
@@ -1683,7 +1683,7 @@ MODULE_INIT_FUNC(libsmb_samba_internal)
 	Py_INCREF(&py_cli_state_type);
 	PyModule_AddObject(m, "Conn", (PyObject *)&py_cli_state_type);
 
-#define ADD_FLAGS(val)	PyModule_AddObject(m, #val, PyInt_FromLong(val))
+#define ADD_FLAGS(val)	PyModule_AddObject(m, #val, PyLong_FromLong(val))
 
 	ADD_FLAGS(FILE_ATTRIBUTE_READONLY);
 	ADD_FLAGS(FILE_ATTRIBUTE_HIDDEN);
diff --git a/source3/passdb/py_passdb.c b/source3/passdb/py_passdb.c
index f7e80c47397..6b7d2a0a7b8 100644
--- a/source3/passdb/py_passdb.c
+++ b/source3/passdb/py_passdb.c
@@ -62,7 +62,7 @@ static PyObject *py_samu_get_logon_time(PyObject *obj, void *closure)
 	struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
 	PyObject *py_logon_time;
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list