mirror of
https://github.com/python/cpython.git
synced 2025-08-25 11:15:02 +00:00
Fixed test_urllibnet
This commit is contained in:
parent
7e182548fa
commit
061ce7fda7
1 changed files with 3 additions and 1 deletions
|
@ -13,10 +13,12 @@ import mimetools
|
||||||
def _open_with_retry(func, host, *args, **kwargs):
|
def _open_with_retry(func, host, *args, **kwargs):
|
||||||
# Connecting to remote hosts is flaky. Make it more robust
|
# Connecting to remote hosts is flaky. Make it more robust
|
||||||
# by retrying the connection several times.
|
# by retrying the connection several times.
|
||||||
|
last_exc = None
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
try:
|
try:
|
||||||
return func(host, *args, **kwargs)
|
return func(host, *args, **kwargs)
|
||||||
except IOError, last_exc:
|
except IOError as err:
|
||||||
|
last_exc = err
|
||||||
continue
|
continue
|
||||||
except:
|
except:
|
||||||
raise
|
raise
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue