simplify condition if you ain't got decode you ain't bytes

This commit is contained in:
Leonel Câmara
2017-09-06 15:37:51 +01:00
parent 83f9016528
commit 4b38186b51
+1 -1
View File
@@ -151,7 +151,7 @@ def with_metaclass(meta, *bases):
def to_unicode(obj, charset='utf-8', errors='strict'):
if obj is None:
return None
if not hasattr(obj, 'decode') and not isinstance(obj, bytes):
if not hasattr(obj, 'decode'):
return text_type(obj)
return obj.decode(charset, errors)