Author: Manuel Jacob <[email protected]>
Branch:
Changeset: r90465:e8bf94789967
Date: 2017-03-02 10:55 +0100
http://bitbucket.org/pypy/pypy/changeset/e8bf94789967/
Log: Use space.eq_w() instead of space.eq() in
W_DictViewItemsObject.descr_contains().
diff --git a/pypy/objspace/std/dictmultiobject.py
b/pypy/objspace/std/dictmultiobject.py
--- a/pypy/objspace/std/dictmultiobject.py
+++ b/pypy/objspace/std/dictmultiobject.py
@@ -1597,7 +1597,7 @@
w_found = None
if w_found is None:
return space.w_False
- return space.eq(w_value, w_found)
+ return space.newbool(space.eq_w(w_value, w_found))
class W_DictViewKeysObject(W_DictViewObject, SetLikeDictView):
def descr_iter(self, space):
diff --git a/pypy/objspace/std/test/test_dictmultiobject.py
b/pypy/objspace/std/test/test_dictmultiobject.py
--- a/pypy/objspace/std/test/test_dictmultiobject.py
+++ b/pypy/objspace/std/test/test_dictmultiobject.py
@@ -842,6 +842,14 @@
assert d.viewitems() != e.viewitems()
assert not d.viewitems() == 42
+ def test_dict_items_contains_with_identity(self):
+ class BadEq(object):
+ def __eq__(self, other):
+ raise ZeroDivisionError
+ k = BadEq()
+ v = BadEq()
+ assert (k, v) in {k: v}.viewitems()
+
def test_dict_mixed_keys_items(self):
d = {(1, 1): 11, (2, 2): 22}
e = {1: 1, 2: 2}
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit