[pypy-svn] r36406 - in pypy/dist/pypy/objspace/std: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Wed Jan 10 15:39:12 CET 2007
Author: cfbolz
Date: Wed Jan 10 15:39:11 2007
New Revision: 36406
Modified:
pypy/dist/pypy/objspace/std/test/test_versionedtype.py
pypy/dist/pypy/objspace/std/typeobject.py
Log:
(pedronis, cfbolz): a test that surprisingly passes, add a comment why.
Modified: pypy/dist/pypy/objspace/std/test/test_versionedtype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_versionedtype.py (original)
+++ pypy/dist/pypy/objspace/std/test/test_versionedtype.py Wed Jan 10 15:39:11 2007
@@ -5,7 +5,7 @@
def setup_class(cls):
cls.space = gettestobjspace(**{"objspace.std.withtypeversion": True})
- def test_tag_changes(self):
+ def get_three_classes(self):
space = self.space
w_types = space.appexec([], """():
class A(object):
@@ -18,7 +18,11 @@
__metaclass__ = metatype
return A, B, C
""")
- w_A, w_B, w_C = space.unpackiterable(w_types)
+ return space.unpackiterable(w_types)
+
+ def test_tag_changes(self):
+ space = self.space
+ w_A, w_B, w_C = self.get_three_classes()
atag = w_A.version_tag
btag = w_B.version_tag
assert atag is not None
@@ -48,6 +52,18 @@
btag = w_B.version_tag
assert atag is not btag
+ def test_tag_changes_when_bases_change(self):
+ space = self.space
+ w_A, w_B, w_C = self.get_three_classes()
+ atag = w_A.version_tag
+ btag = w_B.version_tag
+ w_types = space.appexec([w_A, w_B, w_C], """(A, B, C):
+ class D(object):
+ pass
+ B.__bases__ = (D, )
+ """)
+ assert w_B.version_tag is not btag
+
class AppTestVersionedType(test_typeobject.AppTestTypeObject):
def setup_class(cls):
Modified: pypy/dist/pypy/objspace/std/typeobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/typeobject.py (original)
+++ pypy/dist/pypy/objspace/std/typeobject.py Wed Jan 10 15:39:11 2007
@@ -445,6 +445,7 @@
# but it is needed at bootstrap to avoid a call to w_type.getdict() which
# would un-lazify the whole type.
if space.config.objspace.std.withtypeversion:
+ # also takes care of assignments to __bases__
w_type.mutated()
name = space.str_w(w_name)
w_descr = space.lookup(w_type, name)
More information about the Pypy-commit
mailing list