mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Issue #10836: Fix exception raised when file not found in urlretrieve
This commit is contained in:
parent
8a915499f6
commit
f577686fd3
3 changed files with 10 additions and 2 deletions
|
@ -1664,7 +1664,7 @@ class URLopener:
|
|||
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])
|
||||
|
@ -1891,7 +1891,7 @@ class URLopener:
|
|||
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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue