From 82a3f8afcb0716cf524b4f731e25b4d6dca554a4 Mon Sep 17 00:00:00 2001 From: Florent Xicluna Date: Sat, 14 Aug 2010 18:30:35 +0000 Subject: [PATCH] Silence the BytesWarning, due to patch r83294 for #9301 --- Lib/urllib/parse.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py index 44f4a4b13e7..48b187ac6d9 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')