[Python-checkins] r84038 - python/branches/py3k/Lib/urllib/parse.py

florent.xicluna python-checkins at python.org
Sat Aug 14 20:30:35 CEST 2010


Author: florent.xicluna
Date: Sat Aug 14 20:30:35 2010
New Revision: 84038

Log:
Silence the BytesWarning, due to patch r83294 for #9301

Modified:
   python/branches/py3k/Lib/urllib/parse.py

Modified: python/branches/py3k/Lib/urllib/parse.py
==============================================================================
--- python/branches/py3k/Lib/urllib/parse.py	(original)
+++ python/branches/py3k/Lib/urllib/parse.py	Sat Aug 14 20:30:35 2010
@@ -314,7 +314,9 @@
     """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')


More information about the Python-checkins mailing list