Skip to content

semver.bump_prerelease on *-rc9 results in lower version #460

@Learloj

Description

@Learloj

Which version of Python is the problem with?

3.8

What semver version are you using?

No response

What OS are you using? (Add more in the Environment section)

macOS

Situation

When calling semver.bump_prerelease on a version with a prerelease of -rc9, it gets bumped to -rc10. However. according to the semver spec (https://semver.org/#spec-item-11 section 11.4 items 1+2), 'rc9' is considered a string and will be compared to 'rc10' using ASCII sort order, which considers 'rc10' to be lower than 'rc9'.

How to reproduce

>>> import semver
>>> version1 = '1.0.0-rc9'
>>> version2 = semver.bump_prerelease(version1)
>>> version2
'1.0.0-rc10'
>>> semver.compare(version1, version2)
1

Expected behavior

Not entirely sure how the bump_prerelease version should behalve when it gets rc9. ASCII-wise, after 9 you could consider a, but you get rca, rcb which feels a bit odd. Another option could be that the function just returns some kind of error, indicating it cannot determine how to increase rc9 to a higher value.

Environment

No response

Metadata

Metadata

Assignees

Labels

BugError, flaw or fault to produce incorrect or unexpected results

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy