python-intelhex/intelhex

list(ih) causes the Python interpreter to hang up

jfongattw opened this issue · 1 comments

from intelhex import IntelHex
ih = IntelHex()
ih[0] = 0x55
list(ih)

__getitem__() currently returns either actual bytes for valid addresses or padding bytes for non-existing non-negative addresses. While this is by design, this admittedly is a problem when creating a list from an IntelHex object... A fix would probably be to raise an IndexError when breaching the current maximum address. This would yield empty lists for empty objects and make list generation finite for objects containing data. I'm looking into it.