[pypy-commit] pypy default: fix test_urllib2_localnet - don't be too eager on closing the response, closing

fijal noreply at buildbot.pypy.org
Tue Nov 8 12:08:46 CET 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: 
Changeset: r48913:9827978a2b97
Date: 2011-10-17 11:01 +0200
http://bitbucket.org/pypy/pypy/changeset/9827978a2b97/

Log:	fix test_urllib2_localnet - don't be too eager on closing the
	response, closing it when we have a socket error seems to be enough
	to avoid the leak (and yet you pass tests).

diff --git a/lib-python/modified-2.7/urllib2.py b/lib-python/modified-2.7/urllib2.py
--- a/lib-python/modified-2.7/urllib2.py
+++ b/lib-python/modified-2.7/urllib2.py
@@ -395,11 +395,7 @@
         meth_name = protocol+"_response"
         for processor in self.process_response.get(protocol, []):
             meth = getattr(processor, meth_name)
-            try:
-                response = meth(req, response)
-            except:
-                response.close()
-                raise
+            response = meth(req, response)
 
         return response
 


More information about the pypy-commit mailing list