1
0

Fix KernelVersion comparisons

In the __lt__ function for the class KernelVersions, if
self.groups != other.groups, but self.groups == other.groups[0:n] or
self.groups[0:n] == other.groups for some n, then at some point, one of
the two pieces to be compared will be None, which resulted in an
Exception when calling isdigit.

Hence check whether one of the pieces to be compared is None and handle
this as a special case.

(cherry picked from commit b901203390b4994a8169021d7dc47928561dad24)
Dieser Commit ist enthalten in:
Malte Leip 2019-11-01 21:27:14 +01:00 committet von Marek Marczykowski-Górecki
Ursprung fe56b3e0e7
Commit 5ba012b7d3
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 063938BA42CFA724

Datei anzeigen

@ -134,6 +134,10 @@ class KernelVersion: # pylint: disable=too-few-public-methods
self.groups, other.groups):
if self_content == other_content:
continue
if self_content is None:
return True
if other_content is None:
return False
if self_content.isdigit() and other_content.isdigit():
return int(self_content) < int(other_content)
return self_content < other_content