gh-156187: Fix the warning stacklevel inside a nested set operand - #156188
Open
fedonman wants to merge 1 commit into
Open
gh-156187: Fix the warning stacklevel inside a nested set operand#156188fedonman wants to merge 1 commit into
fedonman wants to merge 1 commit into
Conversation
_parse_charset() derives the stacklevel of its FutureWarning from nested, and the nested-operand path inserts two frames, _parse_operand() and the inner _parse_charset(), while advancing nested by one. The warning was therefore reported against a frame inside the re package instead of the caller, and further off the deeper the nesting.
aisk
approved these changes
Aug 21, 2026
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.
_parse_operand()now passesnested + 2to the inner_parse_charset(), matching the two frames the nested-operand path adds, so aFutureWarningraised inside a nested set operand is reported against the caller at every depth.test_set_operationspins the reported file for the nested-set and the~~spelling.No news entry: set operations in character classes are new in 3.16 and have not shipped, so this folds into the gh-152100 entry.