diff options
author | Douglas Bagnall <douglas.bagnall@catalyst.net.nz> | 2018-02-28 15:59:06 +1300 |
---|---|---|
committer | Douglas Bagnall <dbagnall@samba.org> | 2018-03-01 04:36:15 +0100 |
commit | c21d4bc0a13866f47384805e4a8f729b878841e9 (patch) | |
tree | c41c0f024a3f26aaebe410e9479754709720eab0 /python | |
parent | 0c31d387945ca579b8feb8a18b4aed2f9bcb7de8 (diff) | |
download | samba-c21d4bc0a13866f47384805e4a8f729b878841e9.tar.gz |
py3compat: add strings describing bytes/unicode in both versions
What Python 3 calls "bytes", Python 2 calls "string";
What Python 3 calls "string", Python 2 calls "unicode".
This can cause confusion in e.g. help strings where the precise type
matters. These macros can be used to construct accurate messages for
both versions.
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Thu Mar 1 04:36:15 CET 2018 on sn-devel-144
Diffstat (limited to 'python')
-rw-r--r-- | python/py3compat.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/python/py3compat.h b/python/py3compat.h index f54b3912f17..ce317c65f8e 100644 --- a/python/py3compat.h +++ b/python/py3compat.h @@ -78,6 +78,10 @@ #define PyStr_AsUTF8 PyUnicode_AsUTF8 #define PyStr_AsUTF8AndSize PyUnicode_AsUTF8AndSize +/* description of bytes and string objects */ +#define PY_DESC_PY3_BYTES "bytes" +#define PY_DESC_PY3_STRING "string" + /* Ints */ #define PyInt_Type PyLong_Type @@ -144,6 +148,10 @@ #define PyBytes_ConcatAndDel PyString_ConcatAndDel #define _PyBytes_Resize _PyString_Resize +/* description of bytes and string objects */ +#define PY_DESC_PY3_BYTES "string" +#define PY_DESC_PY3_STRING "unicode" + /* PyArg_ParseTuple/Py_BuildValue argument */ #define PYARG_BYTES_LEN "s#" |