Author: Benjamin Peterson <[email protected]>
Branch: py3k
Changeset: r53492:bf0f05ea0af3
Date: 2012-03-13 16:36 -0500
http://bitbucket.org/pypy/pypy/changeset/bf0f05ea0af3/

Log:    account for math 2.7 brokeness

diff --git a/pypy/module/math/interp_math.py b/pypy/module/math/interp_math.py
--- a/pypy/module/math/interp_math.py
+++ b/pypy/module/math/interp_math.py
@@ -2,6 +2,7 @@
 import sys
 
 from pypy.rlib import rfloat, unroll
+from pypy.rlib.objectmodel import we_are_translated
 from pypy.interpreter.error import OperationError
 from pypy.interpreter.gateway import NoneNotWrapped
 
@@ -380,7 +381,13 @@
 
 def log1p(space, w_x):
     """Find log(x + 1)."""
-    return math1(space, rfloat.log1p, w_x)
+    try:
+        return math1(space, rfloat.log1p, w_x)
+    except OperationError as e:
+        # Python 2.x raises a OverflowError improperly.
+        if we_are_translated() or not e.match(space, space.w_OverflowError):
+            raise
+        raise OperationError(space.w_ValueError, space.wrap("math domain 
error"))
 
 def acosh(space, w_x):
     """Inverse hyperbolic cosine"""
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to