Repository navigation
🐛 fix(spec): compare version specifiers at their written precision - #246
Open
qodelicious wants to merge 1 commit into
Open
qodelicious wants to merge 1 commit into
qodelicious wants to merge 1 commit into
Conversation
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.
PythonSpec.satisfiesskips a specifier item when the candidate has fewer version parts than the item needs. That makes sense for3.12against>=3.12.5, since the micro is unknown. But the needed precision came fromlen(item.version.release), andSimpleVersionalways padsreleaseto three parts. So every item counted as needing a micro, and any spec with only a major and minor passed every specifier.This is what the Windows PEP 514 pre-filter in
_windows/_propose.pyuses. Registry entries only carry a major and minor, so with a specifier like>=3.13the pre-filter let every registered CPython through and each one got spawned to collect its info, only to be rejected byPythonInfo.satisfieslater.The precision now comes from the parts the specifier was written with (the wildcard precision for
==3.12.*, and the pre-release suffix is ignored, the same wayPythonInfo._satisfies_version_specifiercounts them). The candidate is also cut to that precision before the check, matchingPythonInfo.satisfies, so3.12.1satisfies==3.12in both places now. A candidate with fewer parts than the specifier still skips it, as before.The old
test_get_required_precision_attribute_errortest only covered theAttributeErrorpath onitem.version.release, which is gone, so I replaced it with tests for the new precision and forsatisfiesat minor precision. They fail on main and pass here.