[pypy-svn] pypy default: Obscure case, not implemented.

arigo commits-noreply at bitbucket.org
Fri Jan 21 16:19:40 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r41144:7e06988861c4
Date: 2011-01-21 16:19 +0100
http://bitbucket.org/pypy/pypy/changeset/7e06988861c4/

Log:	Obscure case, not implemented.

diff --git a/pypy/objspace/std/test/test_typeobject.py b/pypy/objspace/std/test/test_typeobject.py
--- a/pypy/objspace/std/test/test_typeobject.py
+++ b/pypy/objspace/std/test/test_typeobject.py
@@ -804,6 +804,8 @@
         class AA(object):
             __slots__ = ('a',)
         aa = AA()
+        # the following line works on CPython >= 2.6 but not on PyPy.
+        # but see below for more
         raises(TypeError, "aa.__class__ = A")
         raises(TypeError, "aa.__class__ = object")
         class Z1(A):
@@ -863,6 +865,28 @@
 
         raises(TypeError, "Int().__class__ = int")
 
+        class Order1(object):
+            __slots__ = ['a', 'b']
+        class Order2(object):
+            __slots__ = ['b', 'a']
+        # the following line works on CPython >= 2.6 but not on PyPy.
+        # but see below for more
+        raises(TypeError, "Order1().__class__ = Order2")
+
+        class U1(object):
+            __slots__ = ['a', 'b']
+        class U2(U1):
+            __slots__ = ['c', 'd', 'e']
+        class V1(object):
+            __slots__ = ['a', 'b']
+        class V2(V1):
+            __slots__ = ['c', 'd', 'e']
+        # the following line does not work on CPython >= 2.6 either.
+        # that's just obscure.  Really really.  So we just ignore
+        # the whole issue until someone comes complaining.  Then we'll
+        # just kill slots altogether apart from maybe doing a few checks.
+        raises(TypeError, "U2().__class__ = V2")
+
     def test_name(self):
         class Abc(object):
             pass


More information about the Pypy-commit mailing list