Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def allowed_max(self) -> Version | None:
# The exclusive ordered comparison <V MUST NOT allow a pre-release
# of the specified version unless the specified version is itself a pre-release.
# https://peps.python.org/pep-0440/#exclusive-ordered-comparison
return self.max.first_devrelease()
return self.max.before_first_devrelease()

def allows_lower(self, other: VersionRangeConstraint) -> bool:
_this, _other = self.allowed_min, other.allowed_min
Expand Down
9 changes: 9 additions & 0 deletions src/poetry/core/version/pep440/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,15 @@ def first_prerelease(self: T) -> T:
pre=ReleaseTag(RELEASE_PHASE_ID_ALPHA),
)

def before_first_devrelease(self: T) -> T:
return self.__class__(
epoch=self.epoch,
release=self.release,
pre=self.pre,
post=self.post,
dev=_NEG_INF_TAG,
)

def first_devrelease(self: T) -> T:
return self.__class__(
epoch=self.epoch,
Expand Down