summaryrefslogtreecommitdiff
path: root/simplejson/compat.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-04-24 20:33:09 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2018-04-24 20:33:09 +0300
commit51b69877435b8503b0400eb54461cded7f103ecb (patch)
tree758e02aac0991f7b220d0e50039b6f3358943122 /simplejson/compat.py
parent729945a655b2c351ad4c91293a494c066f3bb152 (diff)
downloadsimplejson-compat.tar.gz
Simplify compatibility code.compat
Since minimal supported Python 3 version is 3.3, the u() helper no longer needed.
Diffstat (limited to 'simplejson/compat.py')
-rw-r--r--simplejson/compat.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/simplejson/compat.py b/simplejson/compat.py
index 6f945cc..b5df5af 100644
--- a/simplejson/compat.py
+++ b/simplejson/compat.py
@@ -5,8 +5,6 @@ if sys.version_info[0] < 3:
PY3 = False
def b(s):
return s
- def u(s):
- return unicode(s, 'unicode_escape')
import cStringIO as StringIO
StringIO = BytesIO = StringIO.StringIO
text_type = unicode
@@ -21,11 +19,8 @@ else:
from importlib import reload as reload_module
else:
from imp import reload as reload_module
- import codecs
def b(s):
- return codecs.latin_1_encode(s)[0]
- def u(s):
- return s
+ return bytes(s, 'latin1')
import io
StringIO = io.StringIO
BytesIO = io.BytesIO
@@ -33,8 +28,6 @@ else:
binary_type = bytes
string_types = (str,)
integer_types = (int,)
-
- def unichr(s):
- return u(chr(s))
+ unichr = chr
long_type = integer_types[-1]