From: Andrew Bartlett Date: Fri, 7 Jun 2019 09:01:19 +0000 (+0200) Subject: py3: Remove PyStr_FromStringAndSize() compatability macro X-Git-Tag: ldb-2.0.5~261 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fa00d435045e6faeb92f5379684f118b131c92c;p=thirdparty%2Fsamba.git py3: Remove PyStr_FromStringAndSize() 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 Reviewed-by: Noel Power --- diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index 6f43cca78ca..958c3afab57 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_FromStringAndSize PyUnicode_FromStringAndSize #define PyStr_FromFormat PyUnicode_FromFormat #define PyStr_FromFormatV PyUnicode_FromFormatV #define PyStr_AsUTF8 PyUnicode_AsUTF8 @@ -104,7 +103,6 @@ static PyObject *PyLdbBytes_FromStringAndSize(const char *msg, int size) return result; } #else -#define PyStr_FromStringAndSize PyString_FromStringAndSize #define PyStr_FromFormat PyString_FromFormat #define PyStr_FromFormatV PyString_FromFormatV #define PyStr_AsUTF8 PyString_AsString @@ -326,7 +324,7 @@ static PyObject *PyObject_FromLdbValue(const struct ldb_val *val) static PyObject *PyStr_FromLdbValue(const struct ldb_val *val) { - return PyStr_FromStringAndSize((const char *)val->data, val->length); + return PyUnicode_FromStringAndSize((const char *)val->data, val->length); } /** @@ -3322,7 +3320,7 @@ static PyObject *py_ldb_msg_element_str(PyLdbMessageElementObject *self) struct ldb_message_element *el = pyldb_MessageElement_AsMessageElement(self); if (el->num_values == 1) - return PyStr_FromStringAndSize((char *)el->values[0].data, el->values[0].length); + return PyUnicode_FromStringAndSize((char *)el->values[0].data, el->values[0].length); else Py_RETURN_NONE; } diff --git a/python/py3compat.h b/python/py3compat.h index bb35673c1a1..bac7ae00d16 100644 --- a/python/py3compat.h +++ b/python/py3compat.h @@ -54,7 +54,6 @@ /* Strings */ -#define PyStr_FromStringAndSize PyUnicode_FromStringAndSize #define PyStr_FromFormat PyUnicode_FromFormat #define PyStr_FromFormatV PyUnicode_FromFormatV #define PyStr_AsString PyUnicode_AsUTF8