Skip to content

fix(specifiers): === uses original string, not normalized, when available#1124

Open
notatallshaw wants to merge 2 commits intopypa:mainfrom
notatallshaw:fix-arbitrary-equality-normalization
Open

fix(specifiers): === uses original string, not normalized, when available#1124
notatallshaw wants to merge 2 commits intopypa:mainfrom
notatallshaw:fix-arbitrary-equality-normalization

Conversation

@notatallshaw
Copy link
Member

Fixes #978
Fixes #766

@notatallshaw notatallshaw force-pushed the fix-arbitrary-equality-normalization branch from 534b89c to 5cf780f Compare March 21, 2026 20:51
@notatallshaw notatallshaw force-pushed the fix-arbitrary-equality-normalization branch from 5cf780f to 23d342e Compare March 21, 2026 21:15
@notatallshaw
Copy link
Member Author

Setuptools test fails because in the test suite it passes ['>=3.0', '!=3.1'] into SpecifierSet this is against the type hint str | Iterable[Specifier].

I can handle this for now, but I think raising a PR on setuptools side makes sense also.

Copy link
Contributor

@henryiii henryiii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So internally this could be storing strings or Specifiers? With SpecifierSet("...") being different from SpecifierSet(["..."])? Seems like we should always make this hold specifiers?

@notatallshaw
Copy link
Member Author

So internally this could be storing strings or Specifiers? With SpecifierSet("...") being different from SpecifierSet(["..."])? Seems like we should always make this hold specifiers?

We could at a isinstance check and expand the type to str | Iterable[Specifier | str] or deprecation warning followed eventually by an assert?

I really don't know what the move is when the type hint is quite clear but the downstream decides to pass something else in, let it be, make it fail, support the use case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

arbitrary equality and version normalization Arbitrary equality not matching when a prerelease? Even with prereleases=True

3 participants