[pypy-svn] r49770 - in pypy/branch/interplevel-oldstyle-classes/pypy/module/__builtin__: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Fri Dec 14 12:04:43 CET 2007


Author: cfbolz
Date: Fri Dec 14 12:04:43 2007
New Revision: 49770

Modified:
   pypy/branch/interplevel-oldstyle-classes/pypy/module/__builtin__/interp_classobj.py
   pypy/branch/interplevel-oldstyle-classes/pypy/module/__builtin__/test/test_classobj.py
Log:
fix a bug found by test_new


Modified: pypy/branch/interplevel-oldstyle-classes/pypy/module/__builtin__/interp_classobj.py
==============================================================================
--- pypy/branch/interplevel-oldstyle-classes/pypy/module/__builtin__/interp_classobj.py	(original)
+++ pypy/branch/interplevel-oldstyle-classes/pypy/module/__builtin__/interp_classobj.py	Fri Dec 14 12:04:43 2007
@@ -267,7 +267,9 @@
     if w_dict is None:
         w_dict = space.newdict()
     elif not space.is_true(space.isinstance(w_dict, space.w_dict)):
-        raise TypeError("instance() second arg must be dictionary or None")
+        raise OperationError(
+            space.w_TypeError,
+            space.wrap("instance() second arg must be dictionary or None"))
     return W_InstanceObject(space, w_class, w_dict)
 
 class W_InstanceObject(Wrappable):

Modified: pypy/branch/interplevel-oldstyle-classes/pypy/module/__builtin__/test/test_classobj.py
==============================================================================
--- pypy/branch/interplevel-oldstyle-classes/pypy/module/__builtin__/test/test_classobj.py	(original)
+++ pypy/branch/interplevel-oldstyle-classes/pypy/module/__builtin__/test/test_classobj.py	Fri Dec 14 12:04:43 2007
@@ -577,6 +577,7 @@
         a = type(a).__new__(type(a), A, {'c': 2})
         assert a.b == 1
         assert a.c == 2
+        raises(TypeError, type(a).__new__, type(a), A, 1)
 
     def test_del(self):
         import gc
@@ -608,3 +609,19 @@
 
         # does not crash
         E() == E()
+
+    def test_multiple_inheritance_more(self):
+        l = []
+        class A:    # classic class
+            def save(self):
+                l.append("A")
+        class B(A):
+            pass
+        class C(A):
+            def save(self):
+                l.append("C")
+        class D(B, C):
+            pass
+
+        D().save()
+        assert l == ['A']



More information about the Pypy-commit mailing list