bpo-32498: urllib.parse.unquote also accepts bytes (GH-7768)

This commit is contained in:
Stein Karlsen 2019-10-14 12:36:29 +02:00 committed by Tal Einat
parent 9cb51f4e20
commit aad2ee0156
4 changed files with 33 additions and 3 deletions

View file

@ -631,6 +631,8 @@ def unquote(string, encoding='utf-8', errors='replace'):
unquote('abc%20def') -> 'abc def'.
"""
if isinstance(string, bytes):
return unquote_to_bytes(string).decode(encoding, errors)
if '%' not in string:
string.split
return string