Adding pycompat.py for py2/py3 work in progress

This commit is contained in:
hakril
2020-02-02 18:18:56 +01:00
parent 46197e763a
commit 2fddd82f00
+19
View File
@@ -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