python-intelhex / intelhex

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

intelhex hangs on using `in` operator #58

Open sveinse opened 2 years ago

sveinse commented 2 years ago

In python, using the in operator is used to test for membership, thus it would be natural to expect that the following expression is valid to test if the given address is present in the hex. However it hangs of an unknown reason.

     is_present = 0x1000 in ih

This has a trivial fix by implementing __contains__. I have implemented a fix and a test for it in my fork: https://github.com/sveinse/intelhex. Please give notice if a PR is wanted for this. https://github.com/sveinse/intelhex

https://github.com/python-intelhex/intelhex/compare/master...sveinse:intelhex:master

bialix commented 1 year ago

Looks good for me. Thanks.

bialix commented 1 year ago

Please, create a pull request, so maintainer can easily merge this.