From bf6cabc8049cbdf4d0b8af33134317a0190a614f Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Wed, 27 Dec 2023 22:24:57 -0800 Subject: [PATCH] Do not round cache mtimes (#4128) Fixes #4116 This logic was introduced in #3821, I believe as a result of copying logic inside mypy that I think isn't relevant to Black --- CHANGES.md | 2 ++ src/black/cache.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 1444463050f..2389f6d39fd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -21,6 +21,8 @@ +- Fix cache mtime logic that resulted in false positive cache hits (#4128) + ### Packaging diff --git a/src/black/cache.py b/src/black/cache.py index c844c37b6f8..cfdbc21e92a 100644 --- a/src/black/cache.py +++ b/src/black/cache.py @@ -101,7 +101,7 @@ def is_changed(self, source: Path) -> bool: st = res_src.stat() if st.st_size != old.st_size: return True - if int(st.st_mtime) != int(old.st_mtime): + if st.st_mtime != old.st_mtime: new_hash = Cache.hash_digest(res_src) if new_hash != old.hash: return True