Conversation
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.
Bug
Flagsinherits theMutableSetoperations, but its constructor expects flag definitions rather than the flag-name iterable that those operations supply. As a result, evenframe.flags &= {"END_HEADERS"}raisesAttributeError: 'str' object has no attribute 'name'when another flag must be removed. Non-mutating intersection, union, difference and symmetric difference fail in the same way, including reflected operations with a plain set.Change
Override the set mixin's
_from_iterablefactory to return an ordinary set. That avoids treating string elements asFlagdefinitions. Non-mutating results do not carry frame-specific validation; in-place operations still retain the originalFlagsobject and validate additions. This matches the regular-set behavior described byFlagsand avoids changing the constructor or the frame's valid-flag definitions.Add coverage for all four non-mutating operations in both operand orders, all four in-place operations, an empty result, and invalid additions. Include a changelog entry.
Validation
On Python 3.12 / Windows, using the repository's pinned public HTTP/2 fixture submodule:
AttributeErrorregressions and one empty-result type assertion).ruff check src/: passed.mypy src/(strict): passed.AI assistance was used to identify, implement, and test this fix. Tests use synthetic flags and the existing public fixture collection.