From f3a87af3d438ed204145155e87254a7cd8bfad18 Mon Sep 17 00:00:00 2001 From: Richard Baltrusch Date: Sun, 23 Jun 2024 16:53:06 +0200 Subject: [PATCH] Revert "Fix TokenFactory.create_value value caching for unhashable values" This reverts commit 5108e07d3514b9b10eaf8d1dd52c3f29bb99262f. --- natscript/internal/token_.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/natscript/internal/token_.py b/natscript/internal/token_.py index 50dfc36..6d4dcc3 100644 --- a/natscript/internal/token_.py +++ b/natscript/internal/token_.py @@ -67,10 +67,7 @@ def create_value(self, value: Hashable) -> tokenvalue.Value: """Returns a new Value object if value cannot be found in the value cache, otherwise returns the existing Value from the cache. """ - try: - return self._value_cache.get(value, tokenvalue.Value(value)) - except TypeError: # unhashable - return tokenvalue.Value(value) + return self._value_cache.get(value, tokenvalue.Value(value)) @staticmethod def create_iterable_value(value: Iterable[Any]) -> tokenvalue.IterableValue: