[pypy-svn] pypy default: Modify test_descr to skip checking assignment of __class__ when the
arigo
commits-noreply at bitbucket.org
Fri Jan 21 16:25:21 CET 2011
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r41145:cb341400f350
Date: 2011-01-21 16:24 +0100
http://bitbucket.org/pypy/pypy/changeset/cb341400f350/
Log: Modify test_descr to skip checking assignment of __class__ when the
target class just happens to have the same slots as the source one.
Add comment.
diff --git a/lib-python/2.7.0/test/test_descr.py b/lib-python/modified-2.7.0/test/test_descr.py
copy from lib-python/2.7.0/test/test_descr.py
copy to lib-python/modified-2.7.0/test/test_descr.py
--- a/lib-python/2.7.0/test/test_descr.py
+++ b/lib-python/modified-2.7.0/test/test_descr.py
@@ -3091,7 +3091,16 @@
class R(J):
__slots__ = ["__dict__", "__weakref__"]
- for cls, cls2 in ((G, H), (G, I), (I, H), (Q, R), (R, Q)):
+ if test_support.check_impl_detail(pypy=False):
+ lst = ((G, H), (G, I), (I, H), (Q, R), (R, Q))
+ else:
+ # Not supported in pypy: changing the __class__ of an object
+ # to another __class__ that just happens to have the same slots.
+ # If needed, we can add the feature, but what we'll likely do
+ # then is to allow mostly any __class__ assignment, even if the
+ # classes have different __slots__, because we it's easier.
+ lst = ((Q, R), (R, Q))
+ for cls, cls2 in lst:
x = cls()
x.a = 1
x.__class__ = cls2
More information about the Pypy-commit
mailing list