Fix python3 compatibility issue

This commit is contained in:
Lucas GRELAUD 2021-02-26 09:33:59 +01:00
parent 4019282285
commit 455fcf0cfd

View File

@ -38,7 +38,10 @@ class x25crc(object):
accum = self.crc
import array
bytes = array.array('B')
bytes.fromstring(buf)
if not (sys.version_info.major == 3 and sys.version_info.minor >= 2):
bytes.fromstring(buf)
else:
bytes.frombytes(buf)
self.accumulate(bytes)