allow zero-length ascii strings

klayout sometimes writes these
This commit is contained in:
jan 2021-03-26 08:22:58 -07:00
parent 288952f961
commit 34a334f6f3

View File

@ -56,7 +56,7 @@ def parse_real8(data: bytes) -> numpy.ndarray:
def parse_ascii(data: bytes) -> bytes: def parse_ascii(data: bytes) -> bytes:
if len(data) == 0: if len(data) == 0:
raise KlamathError(f'Received empty ascii data.') return b''
if data[-1:] == b'\0': if data[-1:] == b'\0':
return data[:-1] return data[:-1]
return data return data