diff options
Diffstat (limited to 'numpy/compat/py3k.py')
-rw-r--r-- | numpy/compat/py3k.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/numpy/compat/py3k.py b/numpy/compat/py3k.py index 4a7866a56..ce79edde8 100644 --- a/numpy/compat/py3k.py +++ b/numpy/compat/py3k.py @@ -6,12 +6,16 @@ from __future__ import division, absolute_import, print_function __all__ = ['bytes', 'asbytes', 'isfileobj', 'getexception', 'strchar', 'unicode', 'asunicode', 'asbytes_nested', 'asunicode_nested', - 'asstr', 'open_latin1'] + 'asstr', 'open_latin1', 'long', 'basestring'] import sys if sys.version_info[0] >= 3: import io + + long = int + integer_types = (int,) + basestring = str bytes = bytes unicode = str @@ -38,13 +42,18 @@ if sys.version_info[0] >= 3: strchar = 'U' + else: bytes = str unicode = unicode + long = long + basestring = basestring + integer_types = (int, long) asbytes = str asstr = str strchar = 'S' + def isfileobj(f): return isinstance(f, file) @@ -56,6 +65,7 @@ else: def open_latin1(filename, mode='r'): return open(filename, mode=mode) + def getexception(): return sys.exc_info()[1] |