From 7c4215c5d7be366501c9215afcc92dc2219bc411 Mon Sep 17 00:00:00 2001 From: pax Date: Fri, 17 Apr 2026 20:15:43 -0500 Subject: [PATCH] cache: document BaseException intent in tempfile cleanup --- booru_viewer/core/cache.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/booru_viewer/core/cache.py b/booru_viewer/core/cache.py index c978392..fa4f108 100644 --- a/booru_viewer/core/cache.py +++ b/booru_viewer/core/cache.py @@ -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: