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.
This commit is contained in:
Jonathan Thiessen
2025-03-24 09:57:06 -07:00
committed by tangential
parent 5e2b5fe213
commit 1b8974d167

View File

@@ -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)