fix(ranges): require matching pre-release policy in difference#1306
Open
notatallshaw wants to merge 1 commit into
Open
fix(ranges): require matching pre-release policy in difference#1306notatallshaw wants to merge 1 commit into
notatallshaw wants to merge 1 commit into
Conversation
intersection and union raise on operands with different configured pre-release policies; difference did not, so a - b silently succeeded where a & ~b raised, dropping a pre-release the subtrahend's policy excludes. Add the same _check_policy_compat guard.
Contributor
|
Codex likes to check 🤖 AI text below 🤖 The new set-relation API can report incorrect subset/superset results for ranges with arbitrary-equality literal admissions. This is a user-visible semantic bug in the added functionality. Review comment:
|
henryiii
reviewed
Jul 2, 2026
|
|
||
| On the version set this matches ``self & ~other``, but the result keeps | ||
| On the version set this matches ``self & ~other``, and the result keeps | ||
| only ``self``'s admissions and pre-release policy: a non-version string |
Contributor
There was a problem hiding this comment.
Does keeping only self's pre-release policy matter if you now throw an error if they don't match? (in the description)
Member
Author
There was a problem hiding this comment.
Yes, the error is thrown on the configured policy being different (prerelease=None, True, False), not on the implied policy (prerelease=None and <1 vs. <1.0dev0).
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.
intersectionandunionraise on operands with different configured pre-release policies;differencedid not, soa - bsucceeded where the equivalenta & ~braises, and dropped a pre-release the subtrahend's policy excludes (e.g.>=1.0minus>=2.0b1withprereleases=Falsedrops2.0b1, which is inaand not inb).