← Back to Pull requests

Close incomplete downloads before removing them #14237

Merged
notatallshaw merged 3 files (91 lines) on Aug 08, 2026 19:56 UTC
View on GitHub
notatallshaw notatallshaw commented on Aug 08, 2026 17:19 UTC
Author

What does this PR do?

Delete an incomplete download only after closing it. Builtin open() does not share delete access on Windows, so os.remove on the still-open file fails with PermissionError (documented), masking the incomplete-download error and leaving the partial file behind. The partial file is now also removed when a server answers a resume request from the wrong offset, which used to leave it on disk on every platform.

PR Checklist:


<!--- Go over all the following points, and put an x in all the boxes that apply. -->
  • I agree to follow the PSF Code of Conduct.

  • I have read and have followed the CONTRIBUTING.md file.

  • I have added a news file fragment (or this PR does not need one).

  • I have read and followed the AI_POLICY.md file, and if any AI tools were used, I have disclosed it below.
  • This bug was found with a sweep of pip's codebase using codex - gpt 5.6 sol ultra.

    Diff: 91 lines (+79 / -12) across 3 files Reviewer: ichard26 Review duration: 157m
    All Vouch review confidence checks passed
    Residual risk 0.04 = Change Risk (0.33) × (1 − Review Confidence (0.89)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.33 · 91 lines diff across 3 files
    0.33
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.89 · 1 substantive comment(s)
    0.89
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    89%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.271
    Real PR Conversation Timeline
    3 items
    ichard26 ichard26 approved these changes on Aug 08, 2026 19:31 UTC
    Approved Reviewer

    Not a fan of the Claude-ism in the code comments here, but LGTM.

    notatallshaw notatallshaw commented on Aug 08, 2026 19:45 UTC
    Author

    Not a fan of the Claude-ism in the code comments here, but LGTM.

    Yeah... cleaned comments

    Reviewers
    Assignees
    notatallshaw notatallshaw
    Labels
    risk: low confidence: 89.1% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 33.0% (LOW) · Higher = larger blast radius
    33.0%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 89.1% · Lower = rushed or shallow review
    89.1%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 3.6% · Safe to merge
    3.6%
    Repository