[3.13] gh-134262: Fix off by one errors in download retry functions (GH-137775)

(cherry picked from commit e64395e8eb)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
This commit is contained in:
Miss Islington (bot) 2025-08-14 21:01:13 +02:00 committed by GitHub
parent a33596765b
commit 4c29fc2b02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -12,7 +12,7 @@ from urllib.request import urlretrieve
def retrieve_with_retries(download_location, output_path, reporthook,
max_retries=7):
"""Download a file with exponential backoff retry and save to disk."""
for attempt in range(max_retries):
for attempt in range(max_retries + 1):
try:
resp = urlretrieve(
download_location,

View file

@ -172,7 +172,7 @@ def download_with_retries(download_location: str,
base_delay: float = 2.25,
max_jitter: float = 1.0) -> typing.Any:
"""Download a file with exponential backoff retry."""
for attempt in range(max_retries):
for attempt in range(max_retries + 1):
try:
resp = urllib.request.urlopen(download_location)
except urllib.error.URLError as ex: