Commit 2ac5de2a authored by Facundo Batista's avatar Facundo Batista

Issue 3314. The sys module is used in an error case.

parent 9f2f8333
...@@ -310,6 +310,10 @@ class UrlParseTestCase(unittest.TestCase): ...@@ -310,6 +310,10 @@ class UrlParseTestCase(unittest.TestCase):
self.assertEqual(urllib.parse.urlparse("http://example.com?blahblah=/foo"), self.assertEqual(urllib.parse.urlparse("http://example.com?blahblah=/foo"),
('http', 'example.com', '', '', 'blahblah=/foo', '')) ('http', 'example.com', '', '', 'blahblah=/foo', ''))
def test_usingsys(self):
# Issue 3314: sys module is used in the error
self.assertRaises(TypeError, urllib.parse.urlencode, "foo")
def test_main(): def test_main():
support.run_unittest(UrlParseTestCase) support.run_unittest(UrlParseTestCase)
......
...@@ -4,6 +4,8 @@ See RFC 1808: "Relative Uniform Resource Locators", by R. Fielding, ...@@ -4,6 +4,8 @@ See RFC 1808: "Relative Uniform Resource Locators", by R. Fielding,
UC Irvine, June 1995. UC Irvine, June 1995.
""" """
import sys
__all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag", __all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag",
"urlsplit", "urlunsplit"] "urlsplit", "urlunsplit"]
...@@ -599,7 +601,6 @@ test_input = """ ...@@ -599,7 +601,6 @@ test_input = """
""" """
def test(): def test():
import sys
base = '' base = ''
if sys.argv[1:]: if sys.argv[1:]:
fn = sys.argv[1] fn = sys.argv[1]
......
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