summaryrefslogtreecommitdiffstats
path: root/Lib/urllib
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-07-30 19:34:36 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2010-07-30 19:34:36 (GMT)
commitd496c4c9360b481ca68b68b6bba6b6687136e442 (patch)
tree5adc1762096fb8acf83605c87c5ea9ba9a9170c0 /Lib/urllib
parent0a9c3e91dc50ce22a48ff7364a6c297ffb91c19a (diff)
downloadcpython-d496c4c9360b481ca68b68b6bba6b6687136e442.zip
cpython-d496c4c9360b481ca68b68b6bba6b6687136e442.tar.gz
cpython-d496c4c9360b481ca68b68b6bba6b6687136e442.tar.bz2
Fix issue9301 - handle unquote({}) kind of case.
Diffstat (limited to 'Lib/urllib')
-rw-r--r--Lib/urllib/parse.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py
index 691c004..a9fa26a 100644
--- a/Lib/urllib/parse.py
+++ b/Lib/urllib/parse.py
@@ -313,9 +313,7 @@ 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 not string:
- if string is None:
- raise TypeError('None object is invalid for unquote_to_bytes()')
+ if string in (b'', ''):
return b''
if isinstance(string, str):
string = string.encode('utf-8')
@@ -340,9 +338,7 @@ def unquote(string, encoding='utf-8', errors='replace'):
unquote('abc%20def') -> 'abc def'.
"""
- if not string:
- if string is None:
- raise TypeError('None object is invalid for unquote() function.')
+ if string in (b'', ''):
return string
res = string.split('%')
if len(res) == 1: