mirror of
https://github.com/ethereum/consensus-specs.git
synced 2026-02-02 13:25:04 -05:00
List[uint64] is not like a type but just for annotation, same for other Generics with __args__, Vector/BytesN work, because their metaclasses produce non-parametrized types, so don't check vector values when type contains args
This commit is contained in:
@@ -246,8 +246,8 @@ class Vector(metaclass=VectorMeta):
|
||||
|
||||
self.items = list(args)
|
||||
|
||||
# cannot check non-type objects
|
||||
if isinstance(cls.elem_type, type):
|
||||
# cannot check non-type objects, or parametrized types
|
||||
if isinstance(cls.elem_type, type) and not hasattr(cls.elem_type, '__args__'):
|
||||
for i, item in enumerate(self.items):
|
||||
if not issubclass(type(item), cls.elem_type):
|
||||
raise TypeError("Typed vector cannot hold differently typed value"
|
||||
|
||||
Reference in New Issue
Block a user