diff options
author | Roy Williams <rwilliams@lyft.com> | 2016-09-22 09:49:24 -0700 |
---|---|---|
committer | Roy Williams <rwilliams@lyft.com> | 2016-09-22 09:49:24 -0700 |
commit | bb1d5c819ec06a3c085fe265f9b6f92752127a28 (patch) | |
tree | 24fc804f29dcd200a149470eebc5293b0eb88081 | |
parent | 8f8a95e568df1fe5eee1833a8553617f0cae7dfa (diff) | |
download | simplejson-bb1d5c819ec06a3c085fe265f9b6f92752127a28.tar.gz |
Use binascii instead of codecs
-rw-r--r-- | simplejson/compat.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/simplejson/compat.py b/simplejson/compat.py index 50d1f0c..270b469 100644 --- a/simplejson/compat.py +++ b/simplejson/compat.py @@ -1,6 +1,5 @@ """Python 3 compatibility shims """ -import codecs import sys if sys.version_info[0] < 3: PY3 = False @@ -16,9 +15,8 @@ if sys.version_info[0] < 3: integer_types = (int, long) unichr = unichr reload_module = reload - __decode_hex = codecs.getdecoder('hex_codec') - def fromhex(s): - return __decode_hex(s)[0] + import binascii + fromhex = binascii.unhexlify else: PY3 = True @@ -26,6 +24,7 @@ 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): |