From ae8d78a3241c13a480de8f6954f2e44123a58eb9 Mon Sep 17 00:00:00 2001 From: HetCreep Date: Mon, 1 Jun 2026 15:15:16 +0700 Subject: [PATCH] fix(version): correct semantic version ordering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `__lt__`/`__gt__` compared each field with independent `or`, so ordering was wrong whenever a lower place-value differed in the opposite direction: Version("v6.0.0") < Version("v5.10.0") # major 6 < 5 -> False, minor 0 < 10 -> True => returns True (wrong) Compare the (major, minor, patch) tuples instead, which Python orders lexicographically — the correct semantic-version behaviour. `__le__`/`__ge__` delegate to these and are fixed transitively. --- DMMGamePlayerFastLauncher/lib/version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DMMGamePlayerFastLauncher/lib/version.py b/DMMGamePlayerFastLauncher/lib/version.py index c5d705e..e8df832 100644 --- a/DMMGamePlayerFastLauncher/lib/version.py +++ b/DMMGamePlayerFastLauncher/lib/version.py @@ -17,13 +17,13 @@ def __ne__(self, other: "Version"): return not self.__eq__(other) def __lt__(self, other: "Version"): - return self.major < other.major or self.minor < other.minor or self.patch < other.patch + return (self.major, self.minor, self.patch) < (other.major, other.minor, other.patch) def __le__(self, other: "Version"): return self.__eq__(other) or self.__lt__(other) def __gt__(self, other: "Version"): - return self.major > other.major or self.minor > other.minor or self.patch > other.patch + return (self.major, self.minor, self.patch) > (other.major, other.minor, other.patch) def __ge__(self, other: "Version"): return self.__eq__(other) or self.__gt__(other)