Kaydet (Commit) c7743aaa authored tarafından Senthil Kumaran's avatar Senthil Kumaran

Fix Issue9301 - urllib.quote(None) to raise TypeError

üst e9a6a7dd
......@@ -413,6 +413,7 @@ class QuotingTests(unittest.TestCase):
"using quote(): %s != %s" % (expected, result))
self.assertEqual(expected, result,
"using quote_plus(): %s != %s" % (expected, result))
self.assertRaises(TypeError, urllib.quote, None)
def test_quoting_space(self):
# Make sure quote() and quote_plus() handle spaces as specified in
......
......@@ -1223,6 +1223,8 @@ def quote(s, safe='/', encoding=None, errors=None):
"""
# fastpath
if not s:
if s is None:
raise TypeError('None object cannot be quoted')
return s
if encoding is not None or isinstance(s, unicode):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment