[Python-3000-checkins] r64781 - in python/branches/py3k/Lib: test/test_urlparse.py urllib/parse.py

facundo.batista python-3000-checkins at python.org
Mon Jul 7 20:24:11 CEST 2008


Author: facundo.batista
Date: Mon Jul  7 20:24:11 2008
New Revision: 64781

Log:

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


Modified:
   python/branches/py3k/Lib/test/test_urlparse.py
   python/branches/py3k/Lib/urllib/parse.py

Modified: python/branches/py3k/Lib/test/test_urlparse.py
==============================================================================
--- python/branches/py3k/Lib/test/test_urlparse.py	(original)
+++ python/branches/py3k/Lib/test/test_urlparse.py	Mon Jul  7 20:24:11 2008
@@ -310,6 +310,10 @@
         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)
 

Modified: python/branches/py3k/Lib/urllib/parse.py
==============================================================================
--- python/branches/py3k/Lib/urllib/parse.py	(original)
+++ python/branches/py3k/Lib/urllib/parse.py	Mon Jul  7 20:24:11 2008
@@ -4,6 +4,8 @@
 UC Irvine, June 1995.
 """
 
+import sys
+
 __all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag",
            "urlsplit", "urlunsplit"]
 
@@ -599,7 +601,6 @@
 """
 
 def test():
-    import sys
     base = ''
     if sys.argv[1:]:
         fn = sys.argv[1]


More information about the Python-3000-checkins mailing list