diff -r 7516d3820146 -r 14fe8320b7d2 Lib/test/test_dict.py --- a/Lib/test/test_dict.py Wed Jun 18 15:37:29 2014 -0600 +++ b/Lib/test/test_dict.py Thu Jun 19 18:04:11 2014 -0700 @@ -672,6 +672,11 @@ pass self._tracked(MyDict()) + def test_list_equality(self): + class A(dict): pass + for dtype in (A, dict): + self.assertEquals([dtype()], [dict()]) + from test import mapping_tests diff -r 7516d3820146 -r 14fe8320b7d2 src/org/python/core/PyDictionary.java --- a/src/org/python/core/PyDictionary.java Wed Jun 18 15:37:29 2014 -0600 +++ b/src/org/python/core/PyDictionary.java Thu Jun 19 18:04:11 2014 -0700 @@ -732,19 +732,15 @@ @Override public boolean equals(Object obj) { - if (obj == null) { - return false; + if (this == obj) { + return true; } - if (getClass() != obj.getClass()) { - return false; + if (obj instanceof PyDictionary) { + return ((PyDictionary) obj).getMap().equals(getMap()); + } else if (obj instanceof Map) { + return getMap().equals((Map) obj); } - final PyDictionary other = (PyDictionary) obj; - ConcurrentMap map = getMap(); - ConcurrentMap otherMap = other.getMap(); - if (map != otherMap && (map == null || !map.equals(otherMap))) { - return false; - } - return true; + return false; } @ExposedMethod(doc = BuiltinDocs.dict___hash___doc)