summaryrefslogtreecommitdiffstats
path: root/Lib/urllib/parse.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-07-19 18:17:19 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2010-07-19 18:17:19 (GMT)
commit79e17f6f666e6b41320b7355c34d8a292fa5b586 (patch)
tree7db7c5eb546ac46879af936aac738eb0ba568ec8 /Lib/urllib/parse.py
parent99212f61db1155c4d82b449078fe337cbd42a19f (diff)
downloadcpython-79e17f6f666e6b41320b7355c34d8a292fa5b586.zip
cpython-79e17f6f666e6b41320b7355c34d8a292fa5b586.tar.gz
cpython-79e17f6f666e6b41320b7355c34d8a292fa5b586.tar.bz2
Fix Issue9301 - urllib.parse.unquote and unquote_to_byte to raise TypeError for None.
Diffstat (limited to 'Lib/urllib/parse.py')
-rw-r--r--Lib/urllib/parse.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py
index 82edea1..691c004 100644
--- a/Lib/urllib/parse.py
+++ b/Lib/urllib/parse.py
@@ -314,6 +314,8 @@ def unquote_to_bytes(string):
# 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()')
return b''
if isinstance(string, str):
string = string.encode('utf-8')
@@ -339,6 +341,8 @@ 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.')
return string
res = string.split('%')
if len(res) == 1: