From fde46b5710cf294a51123c8a728a22690a7efa7e Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Mon, 13 Jan 2025 15:02:37 -0800 Subject: [PATCH] Fix crash with `--cache-dir=/dev/null` 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}