[Python-checkins] r77014 - python/trunk/Lib/test/test_urllib2.py

benjamin.peterson python-checkins at python.org
Thu Dec 24 02:09:53 CET 2009


Author: benjamin.peterson
Date: Thu Dec 24 02:09:53 2009
New Revision: 77014

Log:
fix alleged refleak

Modified:
   python/trunk/Lib/test/test_urllib2.py

Modified: python/trunk/Lib/test/test_urllib2.py
==============================================================================
--- python/trunk/Lib/test/test_urllib2.py	(original)
+++ python/trunk/Lib/test/test_urllib2.py	Thu Dec 24 02:09:53 2009
@@ -292,10 +292,11 @@
             self._tunnel_headers = headers
         else:
             self._tunnel_headers.clear()
-    def request(self, method, url, body=None, headers={}):
+    def request(self, method, url, body=None, headers=None):
         self.method = method
         self.selector = url
-        self.req_headers += headers.items()
+        if headers is not None:
+            self.req_headers += headers.items()
         self.req_headers.sort()
         if body:
             self.data = body
@@ -415,7 +416,11 @@
 class MockHTTPSHandler(urllib2.AbstractHTTPHandler):
     # Useful for testing the Proxy-Authorization request by verifying the
     # properties of httpcon
-    httpconn = MockHTTPClass()
+
+    def __init__(self):
+        urllib2.AbstractHTTPHandler.__init__(self)
+        self.httpconn = MockHTTPClass()
+
     def https_open(self, req):
         return self.do_open(self.httpconn, req)
 


More information about the Python-checkins mailing list