gh-153128: Preserve once warnings across filter changes#153697
Draft
snoopuppy582 wants to merge 1 commit into
Draft
gh-153128: Preserve once warnings across filter changes#153697snoopuppy582 wants to merge 1 commit into
snoopuppy582 wants to merge 1 commit into
Conversation
Keep the C implementation's once registry independent of filter version changes, matching the pure Python implementation. Add a shared regression test and a Library news entry.
|
The following commit authors need to sign the Contributor License Agreement: |
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.
Summary
"once"warning tracking in the global once registry_py_warningsThe C implementation previously reused the per-module warning registry whenever one was available. That registry is deliberately cleared when the filter version changes, so adding even an unrelated filter caused a warning governed by
"once"to be emitted again. The pure Python implementation stores the(text, category)key inonceregistry, which is not filter-versioned.This change factors the key lookup/update logic from the versioned registry helper and uses it with the global once registry.
"default"and"module"tracking remain versioned as before.Fixes #153128.
Tests
PCbuild/build.bat -p x64 -c DebugPCbuild/amd64/python_d.exe -m unittest -v test.test_warnings.CFilterTests.test_once_after_filter_change test.test_warnings.PyFilterTests.test_once_after_filter_changePCbuild/amd64/python_d.exe -m test -v test_warningsPCbuild/amd64/python_d.exe -X context_aware_warnings=1 -m test test_warningsPCbuild/amd64/python_d.exe -m test -R 3:3 test_warningsPCbuild/amd64/python_d.exe Tools/patchcheck/patchcheck.pyAI assistance
OpenAI Codex was used to assist with duplicate research, reproduction, root-cause analysis, the C implementation and regression test, and local verification. The code and this PR description were prepared with that assistance; this PR is submitted as a draft for review.