cache: document BaseException intent in tempfile cleanup
This commit is contained in:
parent
eab805e705
commit
7c4215c5d7
@ -487,6 +487,8 @@ async def _do_download(
|
|||||||
progress_callback(downloaded, total)
|
progress_callback(downloaded, total)
|
||||||
os.replace(tmp_path, local)
|
os.replace(tmp_path, local)
|
||||||
except BaseException:
|
except BaseException:
|
||||||
|
# BaseException on purpose: also clean up the .part file on
|
||||||
|
# Ctrl-C / task cancellation, not just on Exception.
|
||||||
try:
|
try:
|
||||||
tmp_path.unlink(missing_ok=True)
|
tmp_path.unlink(missing_ok=True)
|
||||||
except OSError:
|
except OSError:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user