py bindings: write 'bytes', not 'PY_DESC_PY3_BYTES'
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Tue, 1 Dec 2020 23:27:35 +0000 (12:27 +1300)
committerJeremy Allison <jra@samba.org>
Wed, 17 Mar 2021 17:10:32 +0000 (17:10 +0000)
Because it is shorter, clearer, and reduces py3compat.h

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
python/py3compat.h
source3/libsmb/pylibsmb.c
source4/dsdb/pydsdb.c

index d09947bf90d61b63e81aa3891a123f22b8b8186a..75baa00503f9ad5550628991dd818f57d0ec7f78 100644 (file)
@@ -52,8 +52,6 @@
 
 /* Strings */
 
-/* description of bytes objects */
-#define PY_DESC_PY3_BYTES "bytes"
 
 /* Module init */
 
index 45abbec14d2d52f66eab60802b76dfaf2a09c864..06d821ae3908475ef4e7ff398976875f0ca2bfc4 100644 (file)
@@ -1735,10 +1735,10 @@ static PyMethodDef py_cli_state_methods[] = {
          "chkpath(dir_path) -> True or False\n\n"
          "\t\tReturn true if directory exists, false otherwise." },
        { "savefile", (PyCFunction)py_smb_savefile, METH_VARARGS,
-         "savefile(path, str) -> None\n\n"
-         "\t\tWrite " PY_DESC_PY3_BYTES " str to file." },
+         "savefile(path, bytes) -> None\n\n"
+         "\t\tWrite bytes to file." },
        { "loadfile", (PyCFunction)py_smb_loadfile, METH_VARARGS,
-         "loadfile(path) -> file contents as a " PY_DESC_PY3_BYTES
+         "loadfile(path) -> file contents as a bytes object"
          "\n\n\t\tRead contents of a file." },
        { "get_sd", (PyCFunction)py_smb_get_sd, METH_VARARGS,
          "get_sd(fnum[, security_info=0]) -> security_descriptor object\n\n"
index 95b23d8adc306c548db63a55221c1333ab77bd86..832899ef1a9529a4359bfe9b8028ca8caafb491f 100644 (file)
@@ -587,8 +587,7 @@ static PyObject *py_dsdb_DsReplicaAttribute(PyObject *self, PyObject *args)
                        PyObject *item = PyList_GetItem(el_list, i);
                        if (!(PyBytes_Check(item))) {
                                PyErr_Format(PyExc_TypeError,
-                                            "ldif_element type should be "
-                                            PY_DESC_PY3_BYTES
+                                            "ldif_element type should be bytes"
                                             );
                                talloc_free(tmp_ctx);
                                return NULL;
@@ -698,8 +697,7 @@ static PyObject *py_dsdb_normalise_attributes(PyObject *self, PyObject *args)
                        PyObject *item = PyList_GetItem(el_list, i);
                        if (!PyBytes_Check(item)) {
                                PyErr_Format(PyExc_TypeError,
-                                            "ldif_element type should be "
-                                            PY_DESC_PY3_BYTES
+                                            "ldif_element type should be bytes"
                                             );
                                talloc_free(tmp_ctx);
                                return NULL;