py3: Remove duplicated PyUnicode_Check() after the py3 compat macros were removed
authorAndrew Bartlett <abartlet@samba.org>
Sat, 15 Jun 2019 11:14:49 +0000 (23:14 +1200)
committerNoel Power <npower@samba.org>
Mon, 24 Jun 2019 18:48:53 +0000 (18:48 +0000)
This came about because in py2 we had to check for strings and unicode.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Mon Jun 24 18:48:53 UTC 2019 on sn-devel-184

lib/ldb/pyldb.c
lib/ldb/pyldb_util.c
lib/tevent/pytevent.c
libcli/nbt/pynbt.c
source4/auth/pyauth.c
source4/librpc/rpc/pyrpc.c
source4/param/pyparam.c
source4/param/pyparam_util.c

index 214f1d0d3dde6b4a951fbb5212b87c0c31989d76..85bcd84bc14e9d4ad7a2651d51040e96c5275cc6 100644 (file)
@@ -1134,7 +1134,7 @@ static const char **PyList_AsStrList(TALLOC_CTX *mem_ctx, PyObject *list,
                const char *str = NULL;
                Py_ssize_t size;
                PyObject *item = PyList_GetItem(list, i);
-               if (!(PyUnicode_Check(item) || PyUnicode_Check(item))) {
+               if (!PyUnicode_Check(item)) {
                        PyErr_Format(PyExc_TypeError, "%s should be strings", paramname);
                        talloc_free(ret);
                        return NULL;
index 3889bfe4face5a23531ccf5053acaa3349ebfa61..f8d0664f1e70415629cc6361d042341ce4d4ed24 100644 (file)
@@ -62,7 +62,7 @@ bool pyldb_Object_AsDn(TALLOC_CTX *mem_ctx, PyObject *object,
        struct ldb_dn *odn;
        PyTypeObject *PyLdb_Dn_Type;
 
-       if (ldb_ctx != NULL && (PyUnicode_Check(object) || PyUnicode_Check(object))) {
+       if (ldb_ctx != NULL && (PyUnicode_Check(object))) {
                odn = ldb_dn_new(mem_ctx, ldb_ctx, PyUnicode_AsUTF8(object));
                *dn = odn;
                return true;
index 99b27636b2824bc655f589626af365d9594205e3..73a9bd736e7473a264bd5dfb8f0d9f7d478d0d5a 100644 (file)
@@ -184,7 +184,7 @@ static PyObject *py_register_backend(PyObject *self, PyObject *args)
                return NULL;
        }
 
-       if (!(PyUnicode_Check(name) || PyUnicode_Check(name))) {
+       if (!PyUnicode_Check(name)) {
                PyErr_SetNone(PyExc_TypeError);
                Py_DECREF(name);
                return NULL;
index c440ec933c47279826e516bf5ead4196e1c1630f..a562f6dcb5ef86e8586e1a1c8f30062bf6341bce 100644 (file)
@@ -57,7 +57,7 @@ static PyObject *py_nbt_node_init(PyTypeObject *self, PyObject *args, PyObject *
 
 static bool PyObject_AsDestinationTuple(PyObject *obj, const char **dest_addr, uint16_t *dest_port)
 {
-       if (PyUnicode_Check(obj) || PyUnicode_Check(obj)) {
+       if (PyUnicode_Check(obj)) {
                *dest_addr = PyUnicode_AsUTF8(obj);
                *dest_port = NBT_NAME_SERVICE_PORT;
                return true;
@@ -69,7 +69,7 @@ static bool PyObject_AsDestinationTuple(PyObject *obj, const char **dest_addr, u
                        return false;
                }
 
-               if (!(PyUnicode_Check(PyTuple_GetItem(obj, 0)) || PyUnicode_Check(PyTuple_GetItem(obj, 0)))) {
+               if (!PyUnicode_Check(PyTuple_GetItem(obj, 0))) {
                        PyErr_SetString(PyExc_TypeError, "Destination tuple first element not string");
                        return false;
                }
@@ -126,7 +126,7 @@ static bool PyObject_AsNBTName(PyObject *obj, struct nbt_name_socket *name_socke
                }
        }
 
-       if (PyUnicode_Check(obj) || PyUnicode_Check(obj)) {
+       if (PyUnicode_Check(obj)) {
                /* FIXME: Parse string to be able to interpret things like RHONWYN<02> ? */
                name->name = PyUnicode_AsUTF8(obj);
                if (name->name == NULL) {
index 92fad3d20f0ef2fcd6f7bf5090ad2923beafd3d8..8d44b8572c25f40c54d526e41393d3374eda8867 100644 (file)
@@ -301,7 +301,7 @@ static const char **PyList_AsStringList(TALLOC_CTX *mem_ctx, PyObject *list,
                const char *value;
                Py_ssize_t size;
                PyObject *item = PyList_GetItem(list, i);
-               if (!(PyUnicode_Check(item) || PyUnicode_Check(item))) {
+               if (!PyUnicode_Check(item)) {
                        PyErr_Format(PyExc_TypeError, "%s should be strings", paramname);
                        return NULL;
                }
index cca31a587649a31e6e08fb83fc1d7bca4a4a4f99..3f2f7154fa781c4309bb82aca1350f9983c26035 100644 (file)
@@ -53,7 +53,7 @@ static bool ndr_syntax_from_py_object(PyObject *object, struct ndr_syntax_id *sy
 {
        ZERO_STRUCTP(syntax_id);
 
-       if (PyUnicode_Check(object) || PyUnicode_Check(object)) {
+       if (PyUnicode_Check(object)) {
                return PyString_AsGUID(object, &syntax_id->uuid);
        } else if (PyTuple_Check(object)) {
                PyObject *item = NULL;
@@ -63,7 +63,7 @@ static bool ndr_syntax_from_py_object(PyObject *object, struct ndr_syntax_id *sy
                }
 
                item = PyTuple_GetItem(object, 0);
-               if (!(PyUnicode_Check(item) || PyUnicode_Check(item))) {
+               if (!PyUnicode_Check(item)) {
                        PyErr_SetString(PyExc_ValueError, "Expected GUID as first element in tuple");
                        return false;
                }
index 78018fe0769dd5bec89a6bc3a172b6804951ecc0..d29bb0750484b39e8ef58524e419512b87909cc7 100644 (file)
@@ -534,7 +534,7 @@ static Py_ssize_t py_lp_ctx_len(PyObject *self)
 static PyObject *py_lp_ctx_getitem(PyObject *self, PyObject *name)
 {
        struct loadparm_service *service;
-       if (!(PyUnicode_Check(name) || PyUnicode_Check(name))) {
+       if (!PyUnicode_Check(name)) {
                PyErr_SetString(PyExc_TypeError, "Only string subscripts are supported");
                return NULL;
        }
index 998d731f49e5d056ebd7787300c69a1c3fb1547a..9b9dcd22c909fc6b2f67f0fa71630ac94768bbea 100644 (file)
@@ -34,7 +34,7 @@ _PUBLIC_ struct loadparm_context *lpcfg_from_py_object(TALLOC_CTX *mem_ctx, PyOb
        PyTypeObject *lp_type;
        bool is_lpobj;
 
-       if (PyUnicode_Check(py_obj) || PyUnicode_Check(py_obj)) {
+       if (PyUnicode_Check(py_obj)) {
                lp_ctx = loadparm_init_global(false);
                if (lp_ctx == NULL) {
                        return NULL;