diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-08-08 05:42:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-08 05:42:54 (GMT) |
commit | 662db125cddbca1db68116c547c290eb3943d98e (patch) | |
tree | 06151487dbe4493ef173dd8cc378f4b6cf5c0e4a /Lib/weakref.py | |
parent | 4c69be22df3852f17873a74d015528d9a8ae92d6 (diff) | |
download | cpython-662db125cddbca1db68116c547c290eb3943d98e.zip cpython-662db125cddbca1db68116c547c290eb3943d98e.tar.gz cpython-662db125cddbca1db68116c547c290eb3943d98e.tar.bz2 |
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 'Lib/weakref.py')
-rw-r--r-- | Lib/weakref.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/weakref.py b/Lib/weakref.py index fa7559b..560deee 100644 --- a/Lib/weakref.py +++ b/Lib/weakref.py @@ -75,14 +75,14 @@ class WeakMethod(ref): if not self._alive or not other._alive: return self is other return ref.__eq__(self, other) and self._func_ref == other._func_ref - return False + return NotImplemented def __ne__(self, other): if isinstance(other, WeakMethod): if not self._alive or not other._alive: return self is not other return ref.__ne__(self, other) or self._func_ref != other._func_ref - return True + return NotImplemented __hash__ = ref.__hash__ |