]> granicus.if.org Git - python/commitdiff
Fix an oversight in r83294. unquote() should reject bytes. Issue #9301.
authorFlorent Xicluna <florent.xicluna@gmail.com>
Sat, 31 Jul 2010 08:56:55 +0000 (08:56 +0000)
committerFlorent Xicluna <florent.xicluna@gmail.com>
Sat, 31 Jul 2010 08:56:55 +0000 (08:56 +0000)
Lib/test/test_urllib.py
Lib/urllib/parse.py

index c68fe54b939822ae4eae23a91616e355cd5a5068..cea153e907a6330afa0e7d30d326605ceb95979e 100644 (file)
@@ -557,6 +557,7 @@ class UnquotingTests(unittest.TestCase):
                          "%s" % result)
         self.assertRaises((TypeError, AttributeError), urllib.parse.unquote, None)
         self.assertRaises((TypeError, AttributeError), urllib.parse.unquote, ())
+        self.assertRaises((TypeError, AttributeError), urllib.parse.unquote, b'')
 
     def test_unquoting_badpercent(self):
         # Test unquoting on bad percent-escapes
index a9fa26ad8f6b4f065ab4c16e94222a900357397e..133b9d99b60dd54964dd8dc47fc4cfef8586ba0e 100644 (file)
@@ -338,7 +338,7 @@ def unquote(string, encoding='utf-8', errors='replace'):
 
     unquote('abc%20def') -> 'abc def'.
     """
-    if string in (b'', ''):
+    if string == '':
         return string
     res = string.split('%')
     if len(res) == 1: