[pypy-svn] r36408 - in pypy/dist/pypy/objspace/std: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Wed Jan 10 16:03:30 CET 2007


Author: cfbolz
Date: Wed Jan 10 16:03:29 2007
New Revision: 36408

Modified:
   pypy/dist/pypy/objspace/std/test/test_versionedtype.py
   pypy/dist/pypy/objspace/std/typeobject.py
Log:
(pedronis, cfbolz): don't give a version tag to builtin types that have a dict.


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 16:03:29 2007
@@ -64,6 +64,19 @@
         """)
         assert w_B.version_tag is None
 
+    def test_version_tag_of_builtin_types(self):
+        space = self.space
+        assert space.w_list.version_tag is not None
+        assert space.w_dict.version_tag is not None
+        assert space.type(space.sys).version_tag is None
+        assert space.w_type.version_tag is None
+        w_function = space.appexec([], """():
+            def f():
+                pass
+            return type(f)
+        """)
+        assert w_function.version_tag is None
+
 
 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 16:03:29 2007
@@ -213,7 +213,10 @@
                 return
         w_self.mro_w = w_self.compute_mro()
         if space.config.objspace.std.withtypeversion:
-            w_self.version_tag = VersionTag()
+            if overridetypedef is not None and w_self.hasdict:
+                w_self.version_tag = None
+            else:
+                w_self.version_tag = VersionTag()
 
     def mutated(w_self):
         space = w_self.space



More information about the Pypy-commit mailing list