]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Silence the BytesWarning, due to patch r83294 for #9301
authorFlorent Xicluna <florent.xicluna@gmail.com>
Sat, 14 Aug 2010 18:30:35 +0000 (18:30 +0000)
committerFlorent Xicluna <florent.xicluna@gmail.com>
Sat, 14 Aug 2010 18:30:35 +0000 (18:30 +0000)
Lib/urllib/parse.py

index 44f4a4b13e7d0746ca3073411e6dc8e919e74769..48b187ac6d970f1efda6cbb92a11a1409d4c9d2d 100644 (file)
@@ -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')