Philip Jenvey committed f2a1734


  • Participants
  • Parent commits 2a5c9b3

Comments (0)

Files changed (1)


+import errno
 import math
-import errno
 import py
 import sys
-from rpython.rtyper.lltypesystem import lltype, rffi
-from rpython.tool.sourcetools import func_with_new_name
 from rpython.conftest import cdir
 from rpython.rlib import jit, rposix
+from rpython.rlib.rfloat import INFINITY, NAN, isfinite, isinf, isnan
+from rpython.rtyper.lltypesystem import lltype, rffi
+from import UNDERSCORE_ON_WIN32
+from rpython.tool.sourcetools import func_with_new_name
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 from rpython.translator.platform import platform
-from rpython.rlib.rfloat import isfinite, isinf, isnan, INFINITY, NAN
-from import UNDERSCORE_ON_WIN32
 use_library_isinf_isnan = False
 if sys.platform == "win32":
         # It's no more possible to take the address of some math functions.
         # Ensure that the compiler chooses real functions instead.
         eci = ExternalCompilationInfo(
-            includes = ['math.h', 'float.h'],
-            post_include_bits = ['#pragma function(floor)'],
+            includes=['math.h', 'float.h'],
+            post_include_bits=['#pragma function(floor)'],
         use_library_isinf_isnan = True
     # Some math functions are C99 and not defined by the Microsoft compiler
     cdir = py.path.local(cdir)
     math_eci = ExternalCompilationInfo(
-        include_dirs = [cdir],
-        includes = ['src/ll_math.h'],
+        include_dirs=[cdir],
+        includes=['src/ll_math.h'],
         separate_module_files=[cdir.join('src', 'll_math.c')],
         export_symbols=['_pypy_math_acosh', '_pypy_math_asinh',
 while VERY_LARGE_FLOAT * 100.0 != INFINITY:
     VERY_LARGE_FLOAT *= 64.0
-_lib_isnan = llexternal("_isnan", [lltype.Float], lltype.Signed)
-_lib_finite = llexternal("_finite", [lltype.Float], lltype.Signed)
+_lib_isnan = llexternal('_isnan', [lltype.Float], lltype.Signed)
+_lib_finite = llexternal('_finite', [lltype.Float], lltype.Signed)
 def ll_math_isnan(y):
     # By not calling into the external function the JIT can inline this.
 def ll_math_sqrt(x):
     if x < 0.0:
-        raise ValueError, "math domain error"
+        raise ValueError("math domain error")
     if isfinite(x):
         return sqrt_nonneg(x)
 for name in unary_math_functions:
     can_overflow = name in unary_math_functions_can_overflow
     c99 = name in unary_math_functions_c99
-    globals()['ll_math_' + name] = new_unary_math_function(name, can_overflow, c99)
+    globals()['ll_math_' + name] = new_unary_math_function(name, can_overflow,
+                                                           c99)