const char *str = NULL;
Py_ssize_t size;
PyObject *item = PyList_GetItem(list, i);
- if (!PyStr_Check(item)) {
+ if (!(PyStr_Check(item) || PyUnicode_Check(item))) {
PyErr_Format(PyExc_TypeError, "%s should be strings", paramname);
talloc_free(ret);
return NULL;
me->name = talloc_strdup(me, attr_name);
me->flags = flags;
- if (PyBytes_Check(set_obj) || PyStr_Check(set_obj)) {
+ if (PyBytes_Check(set_obj) || PyUnicode_Check(set_obj)) {
me->num_values = 1;
me->values = talloc_array(me, struct ldb_val, me->num_values);
if (PyBytes_Check(set_obj)) {
return NULL;
}
msg = _msg;
- } else if (PyStr_Check(obj)) {
+ } else if (PyUnicode_Check(obj)) {
msg = PyStr_AsUTF8AndSize(obj, &size);
if (msg == NULL) {
talloc_free(me);
if (py_elements != NULL) {
Py_ssize_t i;
- if (PyBytes_Check(py_elements) || PyStr_Check(py_elements)) {
+ if (PyBytes_Check(py_elements) || PyUnicode_Check(py_elements)) {
char *_msg = NULL;
el->num_values = 1;
el->values = talloc_array(el, struct ldb_val, 1);
char *_msg = NULL;
result = PyBytes_AsStringAndSize(item, &_msg, &size);
msg = _msg;
- } else if (PyStr_Check(item)) {
+ } else if (PyUnicode_Check(item)) {
msg = PyStr_AsUTF8AndSize(item, &size);
result = (msg == NULL) ? -1 : 0;
} else {
struct ldb_dn *odn;
PyTypeObject *PyLdb_Dn_Type;
- if (ldb_ctx != NULL && PyStr_Check(object)) {
+ if (ldb_ctx != NULL && (PyStr_Check(object) || PyUnicode_Check(object))) {
odn = ldb_dn_new(mem_ctx, ldb_ctx, PyStr_AsUTF8(object));
*dn = odn;
return true;