intelhex icon indicating copy to clipboard operation
intelhex copied to clipboard

intelhex hangs on using `in` operator

Open sveinse opened this issue 3 years ago • 2 comments

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

sveinse avatar Jul 21 '22 21:07 sveinse

Looks good for me. Thanks.

bialix avatar Dec 20 '22 10:12 bialix

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

bialix avatar Dec 20 '22 10:12 bialix