diff --git a/pyModeS/c_common.pyx b/pyModeS/c_common.pyx index e774586..18c1768 100644 --- a/pyModeS/c_common.pyx +++ b/pyModeS/c_common.pyx @@ -295,7 +295,7 @@ cpdef int altcode(str msg): @cython.wraparound(False) cpdef int altitude(str binstr): - if len(binstr) != 13 or set(binstr) != set('01'): + if len(binstr) != 13 or not set(binstr).issubset(set("01")): raise RuntimeError("Input must be 13 bits binary string") cdef bytearray _mbin = bytearray(binstr.encode()) diff --git a/pyModeS/py_common.py b/pyModeS/py_common.py index 719f8a6..4310ac3 100644 --- a/pyModeS/py_common.py +++ b/pyModeS/py_common.py @@ -234,7 +234,7 @@ def squawk(binstr: str) -> str: int: altitude in ft """ - if len(binstr) != 13 or set(binstr) != set("01"): + if len(binstr) != 13 or not set(binstr).issubset(set("01")): raise RuntimeError("Input must be 13 bits binary string") C1 = binstr[0] @@ -296,7 +296,7 @@ def altitude(binstr: str) -> Optional[int]: """ alt: Optional[int] - if len(binstr) != 13 or set(binstr) != set("01"): + if len(binstr) != 13 or not set(binstr).issubset(set("01")): raise RuntimeError("Input must be 13 bits binary string") Mbit = binstr[6]