Patches item #1668100, was opened at 2007-02-24 23:20
Message generated for change (Comment added) made by jjlee
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1668100&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Modules
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Jerry Seutter (jseutter)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib2.urlopen() raises OSError instead of URLError

Initial Comment:
See bug 1591774.  

The base problem is that when passing a file:// url into urllib2.urlopen() for 
a file that doesn't exist, the os.stat() call fails with an OSError exception 
which is not caught.  The documentation for urllib2 states that urlopen() 
raises a URLError upon error.

This bug can also be triggered when fetching a http:// url.  A misconfigured 
webserver can cause urllib2.urlopen to use the FileHandler (see bug report).

This patch catches OSError in the FileHandler class and raises it as a 
URLError.  Unit test included.

----------------------------------------------------------------------

Comment By: John J Lee (jjlee)
Date: 2007-02-25 17:01

Message:
Logged In: YES 
user_id=261020
Originator: NO

I recall that when I wrote the urllib2 tests there were a fair few cases
similar to this -- indeed, this particular one is already marked in the
tests with an "XXXX" in test_file().

What do other people think about these -- should they be fixed, or the
docs changed?


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1668100&group_id=5470
_______________________________________________
Patches mailing list
Patches@python.org
http://mail.python.org/mailman/listinfo/patches

Reply via email to