mirror of
https://github.com/hakril/PythonForWindows
synced 2026-06-08 14:31:45 +00:00
Adding pycompat.py for py2/py3 work in progress
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user