Fix crash when coverage exclusions remove an entire range - #281
Merged
mballance merged 1 commit intoSep 17, 2026
Merged
Conversation
Member
|
Many thanks for this! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Covergroups can raise
IndexErrorduring construction when anignore_binsorillegal_binsentry fully removes a normal bin and another exclusion remains._intersect()rewinds the index after removing a range, but the next exclusion previously reused that index before the outer loop could advance it.Apply each exclusion across all surviving ranges before moving to the next exclusion. This keeps the index rewind paired with the loop increment and preserves trimming and splitting of partially excluded ranges.
Add regression tests for complete removal, partial trimming, split ranges, exclusion order, and empty inputs. Covergroup tests check both ignore and illegal bins, including retained normal-bin names, excluded-value hit counts, normal-bin hit counts, and coverage.
Fixes #269.
Validation:
IndexError.Local environment: macOS arm64, Python 3.11.14, PyBoolector 3.2.3.20231106.1, and PyUCIS at
11c39fd03a983fa602eb8967b3640a0fcc532458fromrequirements_dev.txt.