From 3d5b8db04917e1005d317336cc6ac7543ef3929b Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Thu, 24 Dec 2009 01:14:05 +0000 Subject: Merged revisions 77014 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r77014 | benjamin.peterson | 2009-12-23 19:09:53 -0600 (Wed, 23 Dec 2009) | 1 line fix alleged refleak ........ --- Lib/test/test_urllib2.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py index 8227911..1c30e9b 100644 --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -301,10 +301,11 @@ class MockHTTPClass: 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 @@ -424,7 +425,11 @@ class MockHTTPHandler(urllib.request.BaseHandler): class MockHTTPSHandler(urllib.request.AbstractHTTPHandler): # Useful for testing the Proxy-Authorization request by verifying the # properties of httpcon - httpconn = MockHTTPClass() + + def __init__(self): + urllib.request.AbstractHTTPHandler.__init__(self) + self.httpconn = MockHTTPClass() + def https_open(self, req): return self.do_open(self.httpconn, req) -- cgit v0.12