Skip to content

Commit f6fa9f4

Browse files
committed
Fix deserialization to make type annotation datum work
1 parent 311ee29 commit f6fa9f4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pycardano/serialization.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,12 @@ def _restore_typed_primitive(
496496
raise DeserializeException(f"Expected type list but got {type(v)}")
497497
return IndefiniteList([_restore_typed_primitive(t, w) for w in v])
498498
elif isclass(t) and issubclass(t, IndefiniteList):
499-
return IndefiniteList(v)
499+
try:
500+
return IndefiniteList(v)
501+
except TypeError:
502+
raise DeserializeException(
503+
f"Can not initialize IndefiniteList from {v}"
504+
)
500505
elif hasattr(t, "__origin__") and (t.__origin__ is dict):
501506
t_args = t.__args__
502507
if len(t_args) != 2:

0 commit comments

Comments
 (0)