Skip to content

bug: Specifier("==1.0.*") does not contain Version("1a1") #559

@mayeut

Description

@mayeut

This bug was initially reported in #425
In this specific instance, the meaning of the specifier is clear whereas it is not the case in the original description of #425.
This led me to open a specific issue for this one.

>>> from packaging import __version__
>>> print(__version__)
21.4.dev0
>>> from packaging.specifiers import Specifier
>>> from packaging.version import Version
>>> spec = Specifier("==1.0.*")
>>> version1 = Version("1a1")
>>> version2 = Version("1.0a1")
>>> version1 == version2
True
>>> spec.contains(version1, prereleases=True) == spec.contains(version2, prereleases=True)
False

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions