https://github.com/python/cpython/commit/4c29fc2b021e2525bcd6e2556b8278de8bace812 commit: 4c29fc2b021e2525bcd6e2556b8278de8bace812 branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: zware <[email protected]> date: 2025-08-14T19:01:13Z summary:
[3.13] gh-134262: Fix off by one errors in download retry functions (GH-137775) (cherry picked from commit e64395e8eb8d3a9e35e3e534e87d427ff27ab0a5) Co-authored-by: Emma Smith <[email protected]> files: M PCbuild/get_external.py M Tools/build/generate_sbom.py diff --git a/PCbuild/get_external.py b/PCbuild/get_external.py index 99aff63882f5ba..8c1155c74a642c 100755 --- a/PCbuild/get_external.py +++ b/PCbuild/get_external.py @@ -12,7 +12,7 @@ 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, diff --git a/Tools/build/generate_sbom.py b/Tools/build/generate_sbom.py index 82f06f0a7e57f9..60fb21aa2cb730 100644 --- a/Tools/build/generate_sbom.py +++ b/Tools/build/generate_sbom.py @@ -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: _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
