From d7ebe2e6fcd32e4c9c32e007aaa0b130e40a9829 Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Mon, 13 Jan 2025 15:25:09 -0800 Subject: [PATCH] Fix crash with `--cache-fine-grained --cache-dir=/dev/null` (#18457) Fixes #18454 Couldn't easily repro in test suite --- mypy/build.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mypy/build.py b/mypy/build.py index 342331243b96..a7a76a51f958 100644 --- a/mypy/build.py +++ b/mypy/build.py @@ -973,8 +973,10 @@ def write_deps_cache( if st.source_hash: hash = st.source_hash else: - assert st.meta, "Module must be either parsed or cached" - hash = st.meta.hash + if st.meta: + hash = st.meta.hash + else: + hash = "" meta_snapshot[id] = hash meta = {"snapshot": meta_snapshot, "deps_meta": fg_deps_meta}