Skip to content

Commit 4e127ab

Browse files
authored
Merge pull request #46 from fernandez85/compatArrayFix
Fix Python 3.9 compatibility issue with 'array' module
2 parents 9769d3f + 4125dce commit 4e127ab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

intelhex/compat.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def asstr(s):
5757
return s
5858
return s.decode('latin1')
5959

60-
array_tobytes = getattr(array.array, "tobytes", array.array.tostring)
60+
# for python >= 3.2 use 'tobytes', otherwise 'tostring'
61+
array_tobytes = array.array.tobytes if sys.version_info[1] >= 2 else array.array.tostring
6162

6263
IntTypes = (int,)
6364
StrType = str

0 commit comments

Comments
 (0)