storage: keep non-utf8 strings as bytes (#38021)

(this is not supposed to exist)
This commit is contained in:
Frédéric Péters 2019-11-29 12:33:47 +01:00
parent f088bf40bc
commit ce81160605
1 changed files with 4 additions and 1 deletions

View File

@ -114,7 +114,10 @@ def deep_bytes2str(obj, seen=None):
if id(obj) in seen:
return obj
if isinstance(obj, bytes):
return obj.decode('utf-8')
try:
return obj.decode('utf-8')
except UnicodeDecodeError:
return obj
seen[id(obj)] = True
if isinstance(obj, dict):
new_d = {}