Skip to content

Commit

Permalink
Issue 3314. The sys module is used in an error case.
Browse files Browse the repository at this point in the history
  • Loading branch information
facundobatista committed Jul 7, 2008
1 parent 9f2f833 commit 2ac5de2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Lib/test/test_urlparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,10 @@ def test_noslash(self):
self.assertEqual(urllib.parse.urlparse("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():
support.run_unittest(UrlParseTestCase)

Expand Down
3 changes: 2 additions & 1 deletion Lib/urllib/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
UC Irvine, June 1995.
"""

import sys

__all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag",
"urlsplit", "urlunsplit"]

Expand Down Expand Up @@ -599,7 +601,6 @@ def splitvalue(attr):
"""

def test():
import sys
base = ''
if sys.argv[1:]:
fn = sys.argv[1]
Expand Down

0 comments on commit 2ac5de2

Please sign in to comment.