diff options
author | Andrew Bartlett <abartlet@samba.org> | 2019-06-07 10:39:11 +0200 |
---|---|---|
committer | Noel Power <npower@samba.org> | 2019-06-24 17:24:27 +0000 |
commit | f498c819664e9df658651d39f616f5b4d62b4750 (patch) | |
tree | b4849a8c497c3b38027af5c444ea3828418f19a2 /lib | |
parent | 559dd2d25a644239902753e842b808bac1a0b439 (diff) | |
download | samba-f498c819664e9df658651d39f616f5b4d62b4750.tar.gz |
py3: Remove PyStr_Check() compatability macro
We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ldb/pyldb.c | 4 | ||||
-rw-r--r-- | lib/ldb/pyldb_util.c | 4 | ||||
-rw-r--r-- | lib/tevent/pytevent.c | 4 |
3 files changed, 3 insertions, 9 deletions
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index 940e43e3192..7487753c12d 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 PyStr_Check PyUnicode_Check #define PyStr_FromString PyUnicode_FromString #define PyStr_FromStringAndSize PyUnicode_FromStringAndSize #define PyStr_FromFormat PyUnicode_FromFormat @@ -106,7 +105,6 @@ static PyObject *PyLdbBytes_FromStringAndSize(const char *msg, int size) return result; } #else -#define PyStr_Check PyString_Check #define PyStr_FromString PyString_FromString #define PyStr_FromStringAndSize PyString_FromStringAndSize #define PyStr_FromFormat PyString_FromFormat @@ -1157,7 +1155,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 (!(PyStr_Check(item) || PyUnicode_Check(item))) { + if (!(PyUnicode_Check(item) || PyUnicode_Check(item))) { PyErr_Format(PyExc_TypeError, "%s should be strings", paramname); talloc_free(ret); return NULL; diff --git a/lib/ldb/pyldb_util.c b/lib/ldb/pyldb_util.c index 46ee4034122..b153d878351 100644 --- a/lib/ldb/pyldb_util.c +++ b/lib/ldb/pyldb_util.c @@ -30,10 +30,8 @@ static PyObject *ldb_module = NULL; #if PY_MAJOR_VERSION >= 3 -#define PyStr_Check PyUnicode_Check #define PyStr_AsUTF8 PyUnicode_AsUTF8 #else -#define PyStr_Check PyString_Check #define PyStr_AsUTF8 PyString_AsString #endif @@ -70,7 +68,7 @@ bool pyldb_Object_AsDn(TALLOC_CTX *mem_ctx, PyObject *object, struct ldb_dn *odn; PyTypeObject *PyLdb_Dn_Type; - if (ldb_ctx != NULL && (PyStr_Check(object) || PyUnicode_Check(object))) { + if (ldb_ctx != NULL && (PyUnicode_Check(object) || PyUnicode_Check(object))) { odn = ldb_dn_new(mem_ctx, ldb_ctx, PyStr_AsUTF8(object)); *dn = odn; return true; diff --git a/lib/tevent/pytevent.c b/lib/tevent/pytevent.c index a73141bf87d..50252836b69 100644 --- a/lib/tevent/pytevent.c +++ b/lib/tevent/pytevent.c @@ -27,12 +27,10 @@ #include <tevent.h> #if PY_MAJOR_VERSION >= 3 -#define PyStr_Check PyUnicode_Check #define PyStr_FromString PyUnicode_FromString #define PyStr_AsUTF8 PyUnicode_AsUTF8 #define PyInt_FromLong PyLong_FromLong #else -#define PyStr_Check PyString_Check #define PyStr_FromString PyString_FromString #define PyStr_AsUTF8 PyString_AsString #endif @@ -191,7 +189,7 @@ static PyObject *py_register_backend(PyObject *self, PyObject *args) return NULL; } - if (!(PyStr_Check(name) || PyUnicode_Check(name))) { + if (!(PyUnicode_Check(name) || PyUnicode_Check(name))) { PyErr_SetNone(PyExc_TypeError); Py_DECREF(name); return NULL; |