← 输入框|github.com|刷新
Skip to content

semver.VersionInfo allows negative numbers #291

Closed

Description

@tomschr

Situation

If you pass negative numbers into semver.VersionInfo it doesn't raise any errors:

>>> import semver
>>> semver.VersionInfo(-2)                                                                                                                           
VersionInfo(major=-2, minor=0, patch=0, prerelease=None, build=None)

Tested with latest 2.11.0

Proposal

I guess, this shouldn't happen. We should raise a ValueError exception.
Would integrate that into a 2.12.0 release and into the upcoming 3.0.0-alpha0.

@tlaferriere Thomas, can you conform? Do you agree?

Activity

  1. added
    Release_3.x.y
    Bug
    Release_2.x.y
    on Oct 18, 2020
  2. added 3 commits that reference this issue on Oct 18, 2020
    439cbbc
    fba756e
    b25aa07
  3. tlaferriere commented on Oct 19, 2020

    @tlaferriere
    Contributor

    I agree. It is doesn't make sense to have negative version numbers, whichever way you put it.

  4. s-celles commented on Oct 19, 2020

    @s-celles
    Member

    Hi all,

    according to https://semver.org/

    A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative integers, ...

    So according spec, negative integers are not allowed.

  5. tomschr commented on Oct 19, 2020

    @tomschr
    MemberAuthor

    Thanks to both of you for confirming. It's surprising that this bug could survive that long. 😄

  6. added 3 commits that reference this issue on Oct 19, 2020
    0309c63
    7f42ead
    49229d9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugRelease_2.x.yRelease_3.x.y

    Type

    No type

    Fields

    SIze

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions