Author: Alex Gaynor <[email protected]>
Branch: stdlib-2.7.8
Changeset: r73031:8a0c7a93dc5d
Date: 2014-08-24 10:37 -0700
http://bitbucket.org/pypy/pypy/changeset/8a0c7a93dc5d/

Log:    frozenset also has this behavior, but if you check with
        cmp(frozenset(), frozenset()) you won't see it...

diff --git a/pypy/objspace/descroperation.py b/pypy/objspace/descroperation.py
--- a/pypy/objspace/descroperation.py
+++ b/pypy/objspace/descroperation.py
@@ -452,7 +452,8 @@
 
         # The real comparison
         if space.is_w(space.type(w_v), space.type(w_w)):
-            if space.isinstance_w(w_v, space.w_set):
+            if (space.isinstance_w(w_v, space.w_set) or
+                    space.isinstance_w(w_v, space.w_frozenset)):
                 raise OperationError(
                     space.w_TypeError,
                     space.wrap("cannot compare sets using cmp()")
diff --git a/pypy/objspace/std/test/test_setobject.py 
b/pypy/objspace/std/test/test_setobject.py
--- a/pypy/objspace/std/test/test_setobject.py
+++ b/pypy/objspace/std/test/test_setobject.py
@@ -339,6 +339,7 @@
 
     def test_compare(self):
         raises(TypeError, cmp, set('abc'), set('abd'))
+        raises(TypeError, cmp, frozenset('abc'), frozenset('abd'))
         assert set('abc') != 'abc'
         assert not set('abc') < 42
         assert not (set('abc') < set('def'))
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to