[pypy-svn] r49865 - in pypy/dist/pypy/module/__builtin__: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Dec 17 14:33:57 CET 2007


Author: cfbolz
Date: Mon Dec 17 14:33:56 2007
New Revision: 49865

Modified:
   pypy/dist/pypy/module/__builtin__/interp_classobj.py
   pypy/dist/pypy/module/__builtin__/test/test_classobj.py
Log:
fix failures in test_class.py


Modified: pypy/dist/pypy/module/__builtin__/interp_classobj.py
==============================================================================
--- pypy/dist/pypy/module/__builtin__/interp_classobj.py	(original)
+++ pypy/dist/pypy/module/__builtin__/interp_classobj.py	Mon Dec 17 14:33:56 2007
@@ -212,10 +212,15 @@
 
 def make_binary_returning_notimplemented_instance_method(name):
     def binaryop(self, space, w_other):
-        w_meth = self.getattr(space, space.wrap(name), False)
-        if w_meth is None:
-            return space.w_NotImplemented
-        return space.call_function(w_meth, w_other)
+        try:
+            w_meth = self.getattr(space, space.wrap(name), False)
+        except OperationError, e:
+            if e.match(space, space.w_AttributeError):
+                return space.w_NotImplemented
+        else:
+            if w_meth is None:
+                return space.w_NotImplemented
+            return space.call_function(w_meth, w_other)
     return binaryop
 
 def make_binary_instance_method(name):
@@ -321,13 +326,7 @@
         w_descr_get = space.lookup(w_value, '__get__')
         if w_descr_get is None:
             return w_value
-        try:
-            return space.call_function(w_descr_get, w_value, self, self.w_class)
-        except OperationError, e:
-            if exc or not e.match(space, space.w_AttributeError):
-                raise
-            return None
-
+        return space.call_function(w_descr_get, w_value, self, self.w_class)
 
     def descr_getattribute(self, space, w_attr):
         #import pdb; pdb.set_trace()

Modified: pypy/dist/pypy/module/__builtin__/test/test_classobj.py
==============================================================================
--- pypy/dist/pypy/module/__builtin__/test/test_classobj.py	(original)
+++ pypy/dist/pypy/module/__builtin__/test/test_classobj.py	Mon Dec 17 14:33:56 2007
@@ -610,9 +610,15 @@
 
         class E:
             __eq__ = property(booh)
+            __iadd__ = property(booh)
 
+        e = E()
+        raises(TypeError, "e += 1")
         # does not crash
         E() == E()
+        class I:
+            __init__ = property(booh)
+        raises(AttributeError, I)
 
     def test_multiple_inheritance_more(self):
         l = []



More information about the Pypy-commit mailing list