Author: Alex Gaynor <alex.gay...@gmail.com>
Branch: stdlib-2.7.8
Changeset: r73027:fc100e8b8ec1
Date: 2014-08-24 10:27 -0700
http://bitbucket.org/pypy/pypy/changeset/fc100e8b8ec1/

Log:    Fix for set subclasses

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,7 @@
 
         # The real comparison
         if space.is_w(space.type(w_v), space.type(w_w)):
-            if space.is_w(space.type(w_v), space.w_set):
+            if space.isinstance_w(w_v, space.w_set):
                 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
@@ -375,6 +375,11 @@
         assert set() != set('abc')
         assert set('abc') != set('abd')
 
+        class X(set):
+            pass
+
+        raises(TypeError, cmp, X(), X())
+
     def test_libpython_equality(self):
         for thetype in [frozenset, set]:
             word = "aaaaaaaaawfpasrtarspawparst"
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to