Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/zspec/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ def _to_dict_leaf(spec: Specification[Any]) -> dict[str, object]:
hash(spec)
except TypeError:
msg = (
f"Cannot serialize {name}: specification is not hashable. "
f"Use __slots__ for all fields."
)
f"Cannot serialize {name}: specification is not hashable because "
f"a field holds an unhashable value (e.g. a list or dict). "
f"Use hashable values like tuple or frozenset."
)
raise TypeError(msg) from None
data: dict[str, object] = {"type": name}
for s in slots_of(spec):
Expand Down
Loading