python-intelhex / intelhex

Python IntelHex library
BSD 3-Clause "New" or "Revised" License
201 stars 107 forks source link

Merge fails on two IntelHex16bit files... #51

Open thomas-peddle opened 3 years ago

thomas-peddle commented 3 years ago

I am reading a PIC16 flash image from the target (oh instance IntelHex16bit), and merging it with a new image (nh instance IntelHex16bit) and get the following error: nh.merge(oh[base:base+size], overlap='replace') File "C:\Users\md84189\AppData\Local\Programs\Python\Python39\lib\site-packages\intelhex__init.py", line 964, in getitem init.py", line 964, in getitem__ addr1 = addr16 2 TypeError: unsupported operand type(s) for : 'slice' and 'int'

If both instances are IntelHex or if nh instance is IntelHex and oh remains IntelHex16bit, the operation completes.

Note: Using Python 3.9.0, intelhex-2.3.0

fernandez85 commented 3 years ago

the problem is not with merge function, but with getitem method (alows to use indexer "[ ]") probably noone used it, therefore never tested properly current implementation doesn't support slicing, and this is what the error really is saying

When I have some time, I will try to propose some fix for that.