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
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;
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;
return NULL;
}
- if (!(PyUnicode_Check(name) || PyUnicode_Check(name))) {
+ if (!PyUnicode_Check(name)) {
PyErr_SetNone(PyExc_TypeError);
Py_DECREF(name);
return NULL;
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;
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;
}
}
}
- 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) {
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;
}
{
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;
}
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;
}
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;
}
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;