mirror of https://github.com/python/cpython
Fixed test_urllibnet
This commit is contained in:
parent
7e182548fa
commit
061ce7fda7
|
@ -13,10 +13,12 @@ import mimetools
|
|||
def _open_with_retry(func, host, *args, **kwargs):
|
||||
# Connecting to remote hosts is flaky. Make it more robust
|
||||
# by retrying the connection several times.
|
||||
last_exc = None
|
||||
for i in range(3):
|
||||
try:
|
||||
return func(host, *args, **kwargs)
|
||||
except IOError, last_exc:
|
||||
except IOError as err:
|
||||
last_exc = err
|
||||
continue
|
||||
except:
|
||||
raise
|
||||
|
|
Loading…
Reference in New Issue