Author: Manuel Jacob
Branch: remove-set-smm
Changeset: r64139:915179d6e9c8
Date: 2013-05-15 11:47 +0200
http://bitbucket.org/pypy/pypy/changeset/915179d6e9c8/

Log:    Remove set.__cmp__ multi-method.

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
@@ -170,6 +170,11 @@
             w_currently_in_repr = ec._py_repr = space.newdict()
         return setrepr(space, w_currently_in_repr, self)
 
+    def descr_cmp(self, space, w_other):
+        # hack hack until we get the expected result
+        raise OperationError(space.w_TypeError,
+                space.wrap('cannot compare sets using cmp()'))
+
     def descr_eq(self, space, w_other):
         if isinstance(w_other, W_BaseSetObject):
             return space.wrap(self.equals(w_other))
@@ -476,6 +481,7 @@
     __new__ = gateway.interp2app(W_SetObject.descr_new),
     __repr__ = gateway.interp2app(W_BaseSetObject.descr_repr),
     __hash__ = None,
+    __cmp__ = gateway.interp2app(W_BaseSetObject.descr_cmp),
 
     # comparison operators
     __eq__ = gateway.interp2app(W_BaseSetObject.descr_eq),
@@ -577,6 +583,7 @@
     __new__ = gateway.interp2app(W_FrozensetObject.descr_new),
     __repr__ = gateway.interp2app(W_BaseSetObject.descr_repr),
     __hash__ = gateway.interp2app(W_FrozensetObject.descr_hash),
+    __cmp__ = gateway.interp2app(W_BaseSetObject.descr_cmp),
 
     # comparison operators
     __eq__ = gateway.interp2app(W_BaseSetObject.descr_eq),
@@ -1534,15 +1541,6 @@
         w_left.switch_to_empty_strategy()
     return deleted
 
-def cmp__Set_settypedef(space, self, w_other):
-    # hack hack until we get the expected result
-    raise OperationError(space.w_TypeError,
-            space.wrap('cannot compare sets using cmp()'))
-
-cmp__Set_frozensettypedef = cmp__Set_settypedef
-cmp__Frozenset_settypedef = cmp__Set_settypedef
-cmp__Frozenset_frozensettypedef = cmp__Set_settypedef
-
 init_signature = Signature(['some_iterable'], None, None)
 init_defaults = [None]
 def init__Set(space, w_set, __args__):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to