summaryrefslogtreecommitdiff
path: root/version.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-08-08 08:42:54 +0300
committerGitHub <noreply@github.com>2019-08-08 08:42:54 +0300
commitcab8dd1a30b14542fcfe7ab63f8cd8b5358222da (patch)
tree9dfbd7f131eab0f63091b0180e9811dee4863109 /version.py
parent3665ddcf056ef72aa6e8e92aee81684d146d5dde (diff)
downloadpython-setuptools-git-cab8dd1a30b14542fcfe7ab63f8cd8b5358222da.tar.gz
bpo-37685: Fixed __eq__, __lt__ etc implementations in some classes. (GH-14952)
They now return NotImplemented for unsupported type of the other operand.
Diffstat (limited to 'version.py')
-rw-r--r--version.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/version.py b/version.py
index af14cc13..c33bebae 100644
--- a/version.py
+++ b/version.py
@@ -166,6 +166,8 @@ class StrictVersion (Version):
def _cmp (self, other):
if isinstance(other, str):
other = StrictVersion(other)
+ elif not isinstance(other, StrictVersion):
+ return NotImplemented
if self.version != other.version:
# numeric versions don't match
@@ -331,6 +333,8 @@ class LooseVersion (Version):
def _cmp (self, other):
if isinstance(other, str):
other = LooseVersion(other)
+ elif not isinstance(other, LooseVersion):
+ return NotImplemented
if self.version == other.version:
return 0