Correct _construct_result for Python-3

This commit is contained in:
ZyX 2014-07-10 23:08:59 +04:00
parent a92d72b5d7
commit 128921454f
1 changed files with 6 additions and 3 deletions

View File

@ -142,10 +142,13 @@ def _construct_result(r):
if sys.version_info < (3,):
return r
else:
if type(r) is str:
if isinstance(r, str):
return r.encode('utf-8')
elif type(r) is dict or type(r) is list:
raise NotImplementedError
elif isinstance(r, list):
return [_construct_result(i) for i in r]
elif isinstance(r, dict):
return dict(((_construct_result(k), _construct_result(v))
for k, v in r.items()))
return r