This was
(PyUnicode_Check(pystr) || PyBytes_Check(pystr))
This allows us to end the use of Python 2/3 compatability macros.
The one caller will be simplified in the next commit
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <nopower@samba.org>
/* description of bytes objects */
#define PY_DESC_PY3_BYTES "bytes"
-/* Determine if object is really bytes, for code that runs
- * in python2 & python3 (note: PyBytes_Check is replaced by
- * PyString_Check in python2) so care needs to be taken when
- * writing code that will check if incoming type is bytes that
- * will work as expected in python2 & python3
- */
-
-#define IsPy3BytesOrString(pystr) \
- (PyUnicode_Check(pystr) || PyBytes_Check(pystr))
-
-
/* Module init */
#define MODULE_INIT_FUNC(name) \
DATA_BLOB guid_val;
Py_ssize_t _size;
- if (!IsPy3BytesOrString(str) && !PyUnicode_Check(str)) {
+ if (!(PyUnicode_Check(str) || PyBytes_Check(str)) && !PyUnicode_Check(str)) {
PyErr_SetString(PyExc_TypeError, "Expected a string or bytes argument to GUID()");
return -1;
}