mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-12 22:42:36 +08:00
fix(caching): treat bytes as hashable
This commit is contained in:
parent
27d1bd8829
commit
c50efc7a2b
@ -53,7 +53,7 @@ class Unhashable:
|
|||||||
def to_hashable(obj):
|
def to_hashable(obj):
|
||||||
# So that we don't infinitely recurse since frozenset and tuples
|
# So that we don't infinitely recurse since frozenset and tuples
|
||||||
# are Sequences.
|
# are Sequences.
|
||||||
if isinstance(obj, (int, float, str, bool, type(None))):
|
if isinstance(obj, (int, float, str, bool, bytes, type(None))):
|
||||||
return obj
|
return obj
|
||||||
elif isinstance(obj, Mapping):
|
elif isinstance(obj, Mapping):
|
||||||
return frozenset([(to_hashable(k), to_hashable(v)) for k, v in sorted(obj.items())])
|
return frozenset([(to_hashable(k), to_hashable(v)) for k, v in sorted(obj.items())])
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user