From 22f624e12e5b7765c052b8a82b34b050e65fdada Mon Sep 17 00:00:00 2001 From: protolambda Date: Tue, 11 Jun 2019 18:08:27 +0200 Subject: [PATCH] re-order type check for more speed --- test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py | 4 +--- 1 file changed, 1 insertion(+), 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 368041f90..832fd5ae2 100644 --- a/test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py +++ b/test_libs/pyspec/eth2spec/utils/ssz/ssz_typing.py @@ -513,13 +513,11 @@ def read_vector_elem_type(vector_typ: Type[Vector[T, L]]) -> T: def read_elem_type(typ): - if typ == bytes: + if issubclass(typ, bytes): # bytes or bytesN return byte elif is_list_type(typ): return read_list_elem_type(typ) elif is_vector_type(typ): return read_vector_elem_type(typ) - elif issubclass(typ, bytes): # bytes or bytesN - return byte else: raise TypeError("Unexpected type: {}".format(typ))