[pypy-svn] r71391 - in pypy/trunk/pypy/objspace/std: . test

benjamin at codespeak.net benjamin at codespeak.net
Mon Feb 22 02:08:23 CET 2010


Author: benjamin
Date: Mon Feb 22 02:08:22 2010
New Revision: 71391

Modified:
   pypy/trunk/pypy/objspace/std/test/test_typeobject.py
   pypy/trunk/pypy/objspace/std/typeobject.py
Log:
fix assertion error in corner case with mutable builtins

Modified: pypy/trunk/pypy/objspace/std/test/test_typeobject.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/test/test_typeobject.py	(original)
+++ pypy/trunk/pypy/objspace/std/test/test_typeobject.py	Mon Feb 22 02:08:22 2010
@@ -945,6 +945,12 @@
     def setup_class(cls):
         cls.space = gettestobjspace(**{"objspace.std.immutable_builtintypes": False})
 
+    def test_del_type_mro(self):
+        del type.mro
+        # Make sure the default mro function is used.
+        class X(object):
+            pass
+
     def test_mutate_builtintype(self):
         list.a = 1
         def doublelen(self):

Modified: pypy/trunk/pypy/objspace/std/typeobject.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/typeobject.py	(original)
+++ pypy/trunk/pypy/objspace/std/typeobject.py	Mon Feb 22 02:08:22 2010
@@ -605,8 +605,7 @@
         space = w_self.space
         w_metaclass = space.type(w_self)
         w_where, w_mro_func = space.lookup_in_type_where(w_metaclass, 'mro')
-        assert w_mro_func is not None      # because there is one in 'type'
-        if not space.is_w(w_where, space.w_type):
+        if w_mro_func is not None and not space.is_w(w_where, space.w_type):
             w_mro_meth = space.get(w_mro_func, w_self)
             w_mro = space.call_function(w_mro_meth)
             mro_w = space.fixedview(w_mro)



More information about the Pypy-commit mailing list