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

pedronis at codespeak.net pedronis at codespeak.net
Thu Mar 19 12:29:03 CET 2009


Author: pedronis
Date: Thu Mar 19 12:29:01 2009
New Revision: 63065

Modified:
   pypy/trunk/pypy/objspace/descroperation.py
   pypy/trunk/pypy/objspace/test/test_binop_overriding.py
Log:
issue412 testing

checking in the fix and enabling some of the corresponding tests even in non -A runs



Modified: pypy/trunk/pypy/objspace/descroperation.py
==============================================================================
--- pypy/trunk/pypy/objspace/descroperation.py	(original)
+++ pypy/trunk/pypy/objspace/descroperation.py	Thu Mar 19 12:29:01 2009
@@ -267,10 +267,14 @@
             w_right_impl = None
         else:
             w_right_src, w_right_impl = space.lookup_in_type_where(w_typ2, '__rpow__')
-            if (w_left_src is not w_right_src    # XXX see binop_impl
+            # sse binop_impl
+            if (w_left_src is not w_right_src
                 and space.is_true(space.issubtype(w_typ2, w_typ1))):
-                w_obj1, w_obj2 = w_obj2, w_obj1
-                w_left_impl, w_right_impl = w_right_impl, w_left_impl
+                if (w_left_src and w_right_src and
+                    not space.abstract_issubclass_w(w_left_src, w_right_src) and
+                    not space.abstract_issubclass_w(w_typ1, w_right_src)):
+                    w_obj1, w_obj2 = w_obj2, w_obj1
+                    w_left_impl, w_right_impl = w_right_impl, w_left_impl
         if w_left_impl is not None:
             if space.is_w(w_obj3, space.w_None):
                 w_res = space.get_and_call_function(w_left_impl, w_obj1, w_obj2)
@@ -551,8 +555,11 @@
                     w_typ1 = space.w_basestring
                 # -- end of bug compatibility
                 if space.is_true(space.issubtype(w_typ2, w_typ1)):
-                    w_obj1, w_obj2 = w_obj2, w_obj1
-                    w_left_impl, w_right_impl = w_right_impl, w_left_impl
+                    if (w_left_src and w_right_src and
+                   not space.abstract_issubclass_w(w_left_src, w_right_src) and
+                   not space.abstract_issubclass_w(w_typ1, w_right_src)):
+                        w_obj1, w_obj2 = w_obj2, w_obj1
+                        w_left_impl, w_right_impl = w_right_impl, w_left_impl
 
         w_res = _invoke_binop(space, w_left_impl, w_obj1, w_obj2)
         if w_res is not None:

Modified: pypy/trunk/pypy/objspace/test/test_binop_overriding.py
==============================================================================
--- pypy/trunk/pypy/objspace/test/test_binop_overriding.py	(original)
+++ pypy/trunk/pypy/objspace/test/test_binop_overriding.py	Thu Mar 19 12:29:01 2009
@@ -86,8 +86,6 @@
         cls.w_appdirect = cls.space.wrap(option.runappdirect)
 
     def test_overriding_base_binop_explict(self):
-        if not self.appdirect:        
-            skip("fails, issue412")
         class MulBase(object):
             def __init__(self, value):
                 self.value = value
@@ -118,8 +116,6 @@
         assert not fail
 
     def test_binop_combinations_sub(self):
-        if not self.appdirect:        
-            skip("fails, issue412")
         Base, do_test = self.helpers        
         class X(Base):
             pass



More information about the Pypy-commit mailing list