[Python-Dev] cpython (3.2): Fix closes Issue12576 - fix urlopen behavior on sites which do not send (or

Senthil Kumaran senthil at uthcode.com
Wed Jul 27 17:18:45 CEST 2011


On Wed, Jul 27, 2011 at 02:21:59PM +0200, Antoine Pitrou wrote:
> transient_internet doesn't silence ValueError at all.

Yes, that is correct. I missed recollecting it in the first place. I
guess, I did not see using a content manager withing another context
manager block as something nice.. (nothing wrong but just the indented
code with additional wrap of exceptional handler).

But yes, it would be better to wrap it with transient_internet call.
Shall do.

> Well, the test should simply call close() as is done in other tests.

I tried that before responding, it does not silence the Resource
Warning. The fix (at least for these cases where Connection:close
header is not sent) lies in closing request in the urllib.request. It
is tricky as the server is not sending a Connection:close header which
httplib relies on to close the socket.

-- 
Senthil


More information about the Python-Dev mailing list