[pypy-svn] r73709 - in pypy/branch/cpython-extension/pypy/rlib: . test

fijal at codespeak.net fijal at codespeak.net
Tue Apr 13 05:31:16 CEST 2010


Author: fijal
Date: Tue Apr 13 05:31:14 2010
New Revision: 73709

Modified:
   pypy/branch/cpython-extension/pypy/rlib/rarithmetic.py
   pypy/branch/cpython-extension/pypy/rlib/test/test_rarithmetic.py
Log:
An attempt to fix union of INT_real


Modified: pypy/branch/cpython-extension/pypy/rlib/rarithmetic.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/rlib/rarithmetic.py	(original)
+++ pypy/branch/cpython-extension/pypy/rlib/rarithmetic.py	Tue Apr 13 05:31:14 2010
@@ -126,6 +126,8 @@
     raise OverflowError
 
 def compute_restype(self_type, other_type):
+    if self_type is other_type:
+        return self_type
     if other_type in (bool, int, long):
         if self_type is bool:
             return int

Modified: pypy/branch/cpython-extension/pypy/rlib/test/test_rarithmetic.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/rlib/test/test_rarithmetic.py	(original)
+++ pypy/branch/cpython-extension/pypy/rlib/test/test_rarithmetic.py	Tue Apr 13 05:31:14 2010
@@ -365,3 +365,7 @@
 
 def test_isnan():
     assert isnan(NAN)
+
+def test_int_real_union():
+    from pypy.rpython.lltypesystem.rffi import r_int_real
+    assert compute_restype(r_int_real, r_int_real) is r_int_real



More information about the Pypy-commit mailing list