From 2fddd82f0095d07a8f734ae4c268c85437064285 Mon Sep 17 00:00:00 2001 From: hakril Date: Sun, 2 Feb 2020 18:18:56 +0100 Subject: [PATCH] Adding pycompat.py for py2/py3 work in progress --- windows/pycompat.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 windows/pycompat.py diff --git a/windows/pycompat.py b/windows/pycompat.py new file mode 100644 index 0000000..ce8b132 --- /dev/null +++ b/windows/pycompat.py @@ -0,0 +1,19 @@ +import sys + +is_py3 = (sys.version_info.major >= 3) + +if is_py3: + def str_from_ascii_function(s): + return s.decode("ascii") + + int_types = int + basestring = str + anybuff = (str, bytes) + +else: # py2.7 + def str_from_ascii_function(s): + return s + + int_types = (int, long) + basestring = basestring + anybuff = basestring