Kaydet (Commit) 7d6fe18d authored tarafından Sergey Fedoseev's avatar Sergey Fedoseev Kaydeden (comit) Tim Graham

Simplified force_bytes().

üst 09199734
...@@ -99,10 +99,7 @@ def force_bytes(s, encoding='utf-8', strings_only=False, errors='strict'): ...@@ -99,10 +99,7 @@ def force_bytes(s, encoding='utf-8', strings_only=False, errors='strict'):
return s return s
if isinstance(s, memoryview): if isinstance(s, memoryview):
return bytes(s) return bytes(s)
if isinstance(s, Promise) or not isinstance(s, str): return str(s).encode(encoding, errors)
return str(s).encode(encoding, errors)
else:
return s.encode(encoding, errors)
smart_str = smart_text smart_str = smart_text
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment