Commits

Antonio Cuni committed 54ca175

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

  • Participants
  • Parent commits c8036c0
  • Branches py3k

Comments (0)

Files changed (3)

pypy/objspace/std/dictmultiobject.py

         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)

pypy/objspace/std/setobject.py

 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))
 
 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))

pypy/objspace/std/test/test_dictmultiobject.py

         #
         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())