Author: Antonio Cuni <[email protected]>
Branch: py3k
Changeset: r57769:54ca17571e0f
Date: 2012-10-03 12:10 +0200
http://bitbucket.org/pypy/pypy/changeset/54ca17571e0f/
Log: kill some of the workarounds introduced in 03e3cf83880b about == and
!= between sets and ANY, as they are no longer needed. This fixes
the comparison of sets and dictviews
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
@@ -1017,7 +1017,7 @@
exec src.compile() in globals()
- for opname in ['lt', 'le', 'eq', 'ne', 'ge', 'gt']:
+ for opname in ['lt', 'le', 'ne', 'ge', 'gt']:
src = py.code.Source("""
def {opname}__DictViewKeys_ANY(space, w_dictview, w_other):
w_left = space.call_function(space.w_set, w_dictview)
diff --git a/pypy/objspace/std/setobject.py b/pypy/objspace/std/setobject.py
--- a/pypy/objspace/std/setobject.py
+++ b/pypy/objspace/std/setobject.py
@@ -1058,13 +1058,6 @@
eq__Frozenset_settypedef = eq__Set_settypedef
eq__Frozenset_frozensettypedef = eq__Set_settypedef
-def eq__Set_ANY(space, w_left, w_other):
- # workaround to have "set() == 42" return False instead of falling
- # back to cmp(set(), 42) because the latter raises a TypeError
- return space.w_False
-
-eq__Frozenset_ANY = eq__Set_ANY
-
def ne__Set_Set(space, w_left, w_other):
return space.wrap(not w_left.equals(w_other))
@@ -1081,13 +1074,6 @@
ne__Frozenset_settypedef = ne__Set_settypedef
ne__Frozenset_frozensettypedef = ne__Set_settypedef
-
-def ne__Set_ANY(space, w_left, w_other):
- # more workarounds
- return space.w_True
-
-ne__Frozenset_ANY = ne__Set_ANY
-
def contains__Set_ANY(space, w_left, w_other):
try:
return space.newbool(w_left.has_key(w_other))
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
@@ -796,7 +796,12 @@
#
assert d.keys() - {1} == {2, 3}
assert {1, 4} - d.keys() == {4}
-
+ #
+ assert d.keys() == {1, 2, 3}
+ assert {1, 2, 3} == d.keys()
+ assert not d.keys() != {1, 2, 3}
+ assert not {1, 2, 3} != d.keys()
+
def test_keys_items_contained(self):
def helper(fn):
empty = fn(dict())
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit