Repository navigation
🐛 fix(standalone): resume Python downloads cut short of Content-Length - #2453
Merged
gaborbernat merged 3 commits intoNov 16, 2026
Merged
gaborbernat merged 3 commits into
gaborbernat merged 3 commits into
Conversation
Contributor
|
Reviewed this against the resume loop as it stands on main — the mechanics check out:
One cosmetic nit only: The test matrix mirrors the real failure modes (short body, server-ignores-range, resume completion), so this gets my support as-is. |
Contributor
|
5c5f2c0 looks right — the subclass keeps it inside the transient-retry path while carrying the on-disk count, and asserting the retry cause in the test pins the behavior. Good to go from my side. |
HTTPResponse.read(amt) returns b"" instead of raising when the server closes before the advertised Content-Length (python/cpython#115997), so _download_resuming took a dropped connection for a finished download and failed with a checksum mismatch instead of resuming with a Range request. Check response.length after writing the body, as download_script does since pypa#2251, and raise IncompleteRead so the existing backoff resumes from the bytes already on disk.
…error IncompleteRead(b"", missing) reported "0 bytes read" although everything received so far is in the archive on disk, so the retry log and the cause of the final PipxError understated the progress. Raise a subclass whose message counts the bytes on disk instead of a partial body. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The subclass existed only to word the retry log differently, and no handler tells it apart from IncompleteRead, so raise the built-in one. The test checks the retry and its Range header instead of the log text.
gaborbernat
force-pushed
the
fix/resume-truncated-python-download
branch
from
November 16, 2026 22:02
169fa66 to
e21d91b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2452.
A dropped connection while
--fetch-pythondownloaded a standalone Python build ended in a checksum mismatch instead of a resumed download. 🌐 Python's HTTP client returns a body cut short of itsContent-Lengthas if it were complete (python/cpython#115997), so pipx stopped at the partial archive and never used theRangeresume it already has for connections that fail outright.pipx now checks after each attempt whether the server sent fewer bytes than it announced. A short body counts as the same transient network error as a reset connection, so it goes through the existing retry with backoff (three attempts in total) and asks the server for the rest with a
Rangerequest; the archive checksum is still verified afterwards. Script downloads got the same check in #2251.