summaryrefslogtreecommitdiffstats
path: root/Lib/urllib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/urllib')
-rw-r--r--Lib/urllib/parse.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py
index 44f4a4b..48b187a 100644
--- a/Lib/urllib/parse.py
+++ b/Lib/urllib/parse.py
@@ -314,7 +314,9 @@ def unquote_to_bytes(string):
"""unquote_to_bytes('abc%20def') -> b'abc def'."""
# Note: strings are encoded as UTF-8. This is only an issue if it contains
# unescaped non-ASCII characters, which URIs should not.
- if string in (b'', ''):
+ if not string:
+ # Is it a string-like object?
+ string.split
return b''
if isinstance(string, str):
string = string.encode('utf-8')