Skip to content

Commit f567445

Browse files
authored
Clarify and simplify implicit prerelease handling in Specifier.prereleases (#896)
1 parent eeffed4 commit f567445

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/packaging/specifiers.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,10 @@ def prereleases(self) -> bool:
251251
if self._prereleases is not None:
252252
return self._prereleases
253253

254-
# Look at all of our specifiers and determine if they are inclusive
255-
# operators, and if they are if they are including an explicit
256-
# prerelease.
254+
# Only the "!=" operator does not imply prereleases when
255+
# the version in the specifier is a prerelease.
257256
operator, version = self._spec
258-
if operator in ["==", ">=", "<=", "~=", "===", ">", "<"]:
257+
if operator != "!=":
259258
# The == specifier can include a trailing .*, if it does we
260259
# want to remove before parsing.
261260
if operator == "==" and version.endswith(".*"):

0 commit comments

Comments
 (0)