1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

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 <abartlet@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
This commit is contained in:
Andrew Bartlett 2019-06-07 11:01:19 +02:00 committed by Noel Power
parent 34f9a089d8
commit 3fa00d4350
2 changed files with 2 additions and 5 deletions
lib/ldb
python

View File

@ -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;
}

View File

@ -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