summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-12-24 01:09:53 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-12-24 01:09:53 (GMT)
commit3293593b5439a092e7423ccf13ed01f058fc2d63 (patch)
tree00ad1dfe718c6c7827293e9bbef5a4d536651fab
parent9f12d468f4f886d70831b34875e95d5efe9c6323 (diff)
downloadcpython-3293593b5439a092e7423ccf13ed01f058fc2d63.zip
cpython-3293593b5439a092e7423ccf13ed01f058fc2d63.tar.gz
cpython-3293593b5439a092e7423ccf13ed01f058fc2d63.tar.bz2
fix alleged refleak
-rw-r--r--Lib/test/test_urllib2.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index 01c214a..1c57ec6 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -292,10 +292,11 @@ class MockHTTPClass:
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 MockHTTPHandler(urllib2.BaseHandler):
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)