mirror of
https://github.com/ethereum/consensus-specs.git
synced 2026-02-02 10:54:59 -05:00
fix for typing check of vector elements with non-type element type (annotation)
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
from inspect import isclass
|
||||
from typing import List, Iterable, TypeVar, Type, NewType
|
||||
from typing import Union
|
||||
from typing_inspect import get_origin
|
||||
@@ -247,8 +246,8 @@ class Vector(metaclass=VectorMeta):
|
||||
|
||||
self.items = list(args)
|
||||
|
||||
# cannot check non-class objects
|
||||
if isclass(cls.elem_type):
|
||||
# cannot check non-type objects
|
||||
if isinstance(cls.elem_type, type):
|
||||
for i, item in enumerate(self.items):
|
||||
if not isinstance(item, cls.elem_type):
|
||||
raise TypeError("Typed vector cannot hold differently typed value"
|
||||
|
||||
Reference in New Issue
Block a user