cache: document BaseException intent in tempfile cleanup

This commit is contained in:
pax 2026-04-17 20:15:43 -05:00
parent eab805e705
commit 7c4215c5d7

View File

@ -487,6 +487,8 @@ async def _do_download(
progress_callback(downloaded, total)
os.replace(tmp_path, local)
except BaseException:
# BaseException on purpose: also clean up the .part file on
# Ctrl-C / task cancellation, not just on Exception.
try:
tmp_path.unlink(missing_ok=True)
except OSError: