1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

py bindings: write 'bytes', not 'PY_DESC_PY3_BYTES'

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>
This commit is contained in:
Douglas Bagnall 2020-12-02 12:27:35 +13:00 committed by Jeremy Allison
parent ebad0bcb6b
commit f3309818d3
3 changed files with 5 additions and 9 deletions

View File

@ -52,8 +52,6 @@
/* Strings */ /* Strings */
/* description of bytes objects */
#define PY_DESC_PY3_BYTES "bytes"
/* Module init */ /* Module init */

View File

@ -1735,10 +1735,10 @@ static PyMethodDef py_cli_state_methods[] = {
"chkpath(dir_path) -> True or False\n\n" "chkpath(dir_path) -> True or False\n\n"
"\t\tReturn true if directory exists, false otherwise." }, "\t\tReturn true if directory exists, false otherwise." },
{ "savefile", (PyCFunction)py_smb_savefile, METH_VARARGS, { "savefile", (PyCFunction)py_smb_savefile, METH_VARARGS,
"savefile(path, str) -> None\n\n" "savefile(path, bytes) -> None\n\n"
"\t\tWrite " PY_DESC_PY3_BYTES " str to file." }, "\t\tWrite bytes to file." },
{ "loadfile", (PyCFunction)py_smb_loadfile, METH_VARARGS, { "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." }, "\n\n\t\tRead contents of a file." },
{ "get_sd", (PyCFunction)py_smb_get_sd, METH_VARARGS, { "get_sd", (PyCFunction)py_smb_get_sd, METH_VARARGS,
"get_sd(fnum[, security_info=0]) -> security_descriptor object\n\n" "get_sd(fnum[, security_info=0]) -> security_descriptor object\n\n"

View File

@ -587,8 +587,7 @@ static PyObject *py_dsdb_DsReplicaAttribute(PyObject *self, PyObject *args)
PyObject *item = PyList_GetItem(el_list, i); PyObject *item = PyList_GetItem(el_list, i);
if (!(PyBytes_Check(item))) { if (!(PyBytes_Check(item))) {
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"ldif_element type should be " "ldif_element type should be bytes"
PY_DESC_PY3_BYTES
); );
talloc_free(tmp_ctx); talloc_free(tmp_ctx);
return NULL; return NULL;
@ -698,8 +697,7 @@ static PyObject *py_dsdb_normalise_attributes(PyObject *self, PyObject *args)
PyObject *item = PyList_GetItem(el_list, i); PyObject *item = PyList_GetItem(el_list, i);
if (!PyBytes_Check(item)) { if (!PyBytes_Check(item)) {
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"ldif_element type should be " "ldif_element type should be bytes"
PY_DESC_PY3_BYTES
); );
talloc_free(tmp_ctx); talloc_free(tmp_ctx);
return NULL; return NULL;