finally:
self.unfakehttp()
+ def test_missing_localfile(self):
+ # Test for #10836
+ with self.assertRaises(urllib.error.URLError):
+ urlopen('file://localhost/a/file/which/doesnot/exists.py')
+
def test_userpass_inurl(self):
self.fakehttp(b"HTTP/1.0 200 OK\r\n\r\nHello!")
try:
return getattr(self, name)(url)
else:
return getattr(self, name)(url, data)
- except HTTPError:
+ except (HTTPError, URLError):
raise
except socket.error as msg:
raise IOError('socket error', msg).with_traceback(sys.exc_info()[2])
try:
stats = os.stat(localname)
except OSError as e:
- raise URLError(e.errno, e.strerror, e.filename)
+ raise URLError(e.strerror, e.filename)
size = stats.st_size
modified = email.utils.formatdate(stats.st_mtime, usegmt=True)
mtype = mimetypes.guess_type(url)[0]
Library
-------
+- Issue #10836: Fix exception raised when file not found in urlretrieve
+ Initial patch by Ezio Melotti.
+
- Issue #14398: Fix size truncation and overflow bugs in the bz2 module.
- Issue #12692: Fix resource leak in urllib.request when talking to an HTTP