Repository navigation
Conversation
added 3 commits
December 5, 2026 09:54
Assisted-by: Claude (Anthropic, claude-opus-5-5)
Assisted-by: Claude (Anthropic, claude-opus-5-5)
This branch has not been deployed
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.
WarningsRecorder.pop(cls)returned the last match instead of the first one when the recorded warnings had unrelated categories (siblings that are both subclasses ofcls). The loop replaced the best candidate every time the new category was not a subclass of the current one, so with siblings the last one always won.The fix collects the matching categories, keeps only the ones that are not a subclass of another match, and returns the first recorded warning with one of those categories. This follows the docstring ("Pop the first recorded warning which is an instance of
cls, but not an instance of a child class of any other match").I first tried comparing every match against every other match, but it was O(n²):
poptook ~700 ms with 5000 recorded warnings. The current version only compares distinct categories, so it stays linear (on my machine, 0.97 ms before and 0.81 ms after with 5000 warnings).Testing:
testing/test_recwarn.py; both fail onmainand pass with the fix.Closes #15097
closes #XYZWto the PR description.changelogdirectory.AUTHORSin alphabetical order.AI disclosure: I used Claude (Anthropic) as an assistant to reproduce the bug, draft the tests and the fix, and measure performance. The commits are credited with an
Assisted-bytrailer, as allowed by the contributing guide. I reviewed and understand the change and I will answer the review myself.