You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
833 B

  1. From 4125dce5b174401d38cc0fcf9d2e1aad07997f5e Mon Sep 17 00:00:00 2001
  2. From: fernandez85 <fernandez2005@gmail.com>
  3. Date: Sun, 11 Oct 2020 12:39:06 +0200
  4. Subject: [PATCH] Fix Python 3.9 compatibility issue with 'array' module
  5. ---
  6. intelhex/compat.py | 3 ++-
  7. 1 file changed, 2 insertions(+), 1 deletion(-)
  8. diff --git a/intelhex/compat.py b/intelhex/compat.py
  9. index 194cd5d..2a6bee6 100644
  10. --- a/intelhex/compat.py
  11. +++ b/intelhex/compat.py
  12. @@ -57,7 +57,8 @@ if sys.version_info[0] >= 3:
  13. return s
  14. return s.decode('latin1')
  15. - array_tobytes = getattr(array.array, "tobytes", array.array.tostring)
  16. + # for python >= 3.2 use 'tobytes', otherwise 'tostring'
  17. + array_tobytes = array.array.tobytes if sys.version_info[1] >= 2 else array.array.tostring
  18. IntTypes = (int,)
  19. StrType = str
  20. --
  21. 2.28.0