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:
committed by
tangential
parent
5e2b5fe213
commit
1b8974d167
@@ -246,6 +246,12 @@ class FlakeCacheEntry:
|
|||||||
if self.value != value:
|
if self.value != value:
|
||||||
msg = "value mismatch in cache, something is fishy"
|
msg = "value mismatch in cache, something is fishy"
|
||||||
raise TypeError(msg)
|
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:
|
else:
|
||||||
msg = f"Cannot insert value of type {type(value)} into cache"
|
msg = f"Cannot insert value of type {type(value)} into cache"
|
||||||
raise TypeError(msg)
|
raise TypeError(msg)
|
||||||
|
|||||||
Reference in New Issue
Block a user