Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Permit contains calls to Specifier[Set] to use arbitrary strings #767

Open
pradyunsg opened this issue Jan 6, 2024 · 0 comments
Open

Permit contains calls to Specifier[Set] to use arbitrary strings #767

pradyunsg opened this issue Jan 6, 2024 · 0 comments

Comments

@pradyunsg
Copy link
Member

pradyunsg commented Jan 6, 2024

The following should not raise an InvalidVersion exception, and should return False instead.

❯ python -c 'from packaging.specifiers import SpecifierSet; print(SpecifierSet("===foobar", prereleases=True).contains("foobar"))'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/pradyunsg/Developer/github/packaging/src/packaging/specifiers.py", line 927, in contains
    item = Version(item)
           ^^^^^^^^^^^^^
  File "/Users/pradyunsg/Developer/github/packaging/src/packaging/version.py", line 200, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: 'foobar'
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant