diff options
Diffstat (limited to 'simplejson/compat.py')
-rw-r--r-- | simplejson/compat.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/simplejson/compat.py b/simplejson/compat.py index b5df5af..5fc1412 100644 --- a/simplejson/compat.py +++ b/simplejson/compat.py @@ -5,8 +5,11 @@ if sys.version_info[0] < 3: PY3 = False def b(s): return s - import cStringIO as StringIO - StringIO = BytesIO = StringIO.StringIO + try: + from cStringIO import StringIO + except ImportError: + from StringIO import StringIO + BytesIO = StringIO text_type = unicode binary_type = str string_types = (basestring,) @@ -21,9 +24,7 @@ else: from imp import reload as reload_module def b(s): return bytes(s, 'latin1') - import io - StringIO = io.StringIO - BytesIO = io.BytesIO + from io import StringIO, BytesIO text_type = str binary_type = bytes string_types = (str,) |