commit | eb318d3b160a1631e462d1434e2ae9e1b5cfe158 | [log] [tgz] |
---|---|---|
author | Benjamin Peterson <benjamin@python.org> | Fri May 21 20:51:45 2010 +0000 |
committer | Benjamin Peterson <benjamin@python.org> | Fri May 21 20:51:45 2010 +0000 |
tree | 6fb0f3dbcce7240d5c50b03f54736f2f16efa19b | |
parent | 16fd5cdfebf67c4d3652cdba64d5fa2556054ca0 [diff] [blame] |
return NotImplemented from Mapping when comparing to a non-mapping #8729
diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py index 326c1f9..ad5a9c0 100644 --- a/Lib/_abcoll.py +++ b/Lib/_abcoll.py
@@ -369,8 +369,9 @@ __hash__ = None def __eq__(self, other): - return isinstance(other, Mapping) and \ - dict(self.items()) == dict(other.items()) + if not isinstance(other, Mapping): + return NotImplemented + return dict(self.items()) == dict(other.items()) def __ne__(self, other): return not (self == other)