Handle passing str to json_loads

This commit is contained in:
Kovid Goyal 2019-03-17 20:07:22 +05:30
parent 7d7731f5d0
commit dc4c444a71
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -62,7 +62,9 @@ def json_dumps(obj):
def json_loads(raw):
import json
return json.loads(raw.decode('utf-8'), object_hook=from_json)
if isinstance(raw, bytes):
raw = raw.decode('utf-8')
return json.loads(raw, object_hook=from_json)
def make_config_dir():