[issue13736] urllib.request.urlopen leaks exceptions from socket and httplib.client

Senthil Kumaran report at bugs.python.org
Wed Feb 8 17:26:52 CET 2012


Senthil Kumaran <senthil at uthcode.com> added the comment:

I have stumbled upon a wrong impression as well by reading the docs, but usually in the code, I tend to catch the specific Exceptions, like timeout instead or URLError when it is known. I saw some libraries following similar pattern too. But that could be changed, if promise in the docs that URLError exception is raised is corrected. 

I think, the course of action for this bug could be.

1. raise ... from .. for the appropriate Exception in 3.3 and appropriate doc changes.
2. Doc changes in 2.7,3.2 which say indicate the possibility of other exceptions besides URLError.

Having any important information in the msg part of the Exception is a bad idea, because it is seldom relied upon and can be changed anytime.

Shall come out with a patch.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13736>
_______________________________________


More information about the Python-bugs-list mailing list