From a7554d503c10d1bb423731486ae45c3d1258168a Mon Sep 17 00:00:00 2001 From: protolambda Date: Wed, 5 Jun 2019 18:02:39 +0200 Subject: [PATCH] fix for typing check of vector elements with non-type element type (annotation) --- test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py b/test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py index 1e05ccd5d..8c2fc359c 100644 --- a/test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py +++ b/test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py @@ -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"