From 1b8974d167dc947f43c406c1a2862c80134701ab Mon Sep 17 00:00:00 2001 From: Jonathan Thiessen Date: Mon, 24 Mar 2025 09:57:06 -0700 Subject: [PATCH] Fix cached None support in FlakeCacheEntry Previously, you could cache None values; however, insertion wasn't idempotent/identical reinsertion would lead to errors due to missing None checks. --- pkgs/clan-cli/clan_cli/flake.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/clan-cli/clan_cli/flake.py b/pkgs/clan-cli/clan_cli/flake.py index 6dbb9910f..e23d012b4 100644 --- a/pkgs/clan-cli/clan_cli/flake.py +++ b/pkgs/clan-cli/clan_cli/flake.py @@ -246,6 +246,12 @@ class FlakeCacheEntry: if self.value != value: msg = "value mismatch in cache, something is fishy" raise TypeError(msg) + + elif value is None: + if self.value is not None: + msg = "value mismatch in cache, something is fishy" + raise TypeError(msg) + else: msg = f"Cannot insert value of type {type(value)} into cache" raise TypeError(msg)