diff --git a/numpy/_core/config.h.in b/numpy/_core/config.h.in index 9c17990d3331..7ef169c44427 100644 --- a/numpy/_core/config.h.in +++ b/numpy/_core/config.h.in @@ -12,6 +12,7 @@ #mesondefine HAVE___DECLSPEC_THREAD_ /* Optional headers */ +#mesondefine HAVE_FEATURES_H #mesondefine HAVE_XLOCALE_H #mesondefine HAVE_DLFCN_H #mesondefine HAVE_EXECINFO_H diff --git a/numpy/_core/src/common/npy_config.h b/numpy/_core/src/common/npy_config.h index 715b17777aed..e590366888aa 100644 --- a/numpy/_core/src/common/npy_config.h +++ b/numpy/_core/src/common/npy_config.h @@ -160,8 +160,29 @@ #undef HAVE_CACOSHL #endif /* __GLIBC_PREREQ(2, 18) */ -#endif /* defined(__GLIBC_PREREQ) */ +#else /* defined(__GLIBC) */ +/* musl linux?, see issue #25092 */ +#undef HAVE_CASIN +#undef HAVE_CASINF +#undef HAVE_CASINL +#undef HAVE_CASINH +#undef HAVE_CASINHF +#undef HAVE_CASINHL +#undef HAVE_CATAN +#undef HAVE_CATANF +#undef HAVE_CATANL +#undef HAVE_CATANH +#undef HAVE_CATANHF +#undef HAVE_CATANHL +#undef HAVE_CACOS +#undef HAVE_CACOSF +#undef HAVE_CACOSL +#undef HAVE_CACOSH +#undef HAVE_CACOSHF +#undef HAVE_CACOSHL + +#endif /* defined(__GLIBC) */ #endif /* defined(HAVE_FEATURES_H) */ #endif /* NUMPY_CORE_SRC_COMMON_NPY_CONFIG_H_ */ diff --git a/numpy/_core/tests/test_umath.py b/numpy/_core/tests/test_umath.py index 39a4f7534e50..aa8e1097149a 100644 --- a/numpy/_core/tests/test_umath.py +++ b/numpy/_core/tests/test_umath.py @@ -1354,21 +1354,9 @@ def test_log_values(self): # test log() of max for dtype does not raise for dt in ['f', 'd', 'g']: - try: - with np.errstate(all='raise'): - x = np.finfo(dt).max - np.log(x) - except FloatingPointError as exc: - if dt == 'g' and IS_MUSL: - # FloatingPointError is known to occur on longdouble - # for musllinux_x86_64 x is very large - pytest.skip( - "Overflow has occurred for" - " np.log(np.finfo(np.longdouble).max)" - ) - else: - raise exc - + with np.errstate(all='raise'): + x = np.finfo(dt).max + np.log(x) def test_log_strides(self): np.random.seed(42) strides = np.array([-4,-3,-2,-1,1,2,3,4]) @@ -1712,6 +1700,9 @@ def test_arctanh(self): assert_raises(FloatingPointError, np.arctanh, np.array(value, dtype=dt)) + # Make sure glibc < 2.18 atanh is not used, issue 25087 + assert np.signbit(np.arctanh(-1j).real) + # See: https://github.com/numpy/numpy/issues/20448 @pytest.mark.xfail( _glibc_older_than("2.17"), @@ -1896,9 +1887,9 @@ def test_ldexp(self, dtype, stride): class TestFRExp: @pytest.mark.parametrize("stride", [-4,-2,-1,1,2,4]) @pytest.mark.parametrize("dtype", ['f', 'd']) - @pytest.mark.xfail(IS_MUSL, reason="gh23048") @pytest.mark.skipif(not sys.platform.startswith('linux'), reason="np.frexp gives different answers for NAN/INF on windows and linux") + @pytest.mark.xfail(IS_MUSL, reason="gh23049") def test_frexp(self, dtype, stride): arr = np.array([np.nan, np.nan, np.inf, -np.inf, 0.0, -0.0, 1.0, -1.0], dtype=dtype) mant_true = np.array([np.nan, np.nan, np.inf, -np.inf, 0.0, -0.0, 0.5, -0.5], dtype=dtype) @@ -4135,7 +4126,6 @@ def test_it(self): assert_almost_equal(fz.real, fr, err_msg='real part %s' % f) assert_almost_equal(fz.imag, 0., err_msg='imag part %s' % f) - @pytest.mark.xfail(IS_MUSL, reason="gh23049") @pytest.mark.xfail(IS_WASM, reason="doesn't work") def test_precisions_consistent(self): z = 1 + 1j @@ -4146,7 +4136,6 @@ def test_precisions_consistent(self): assert_almost_equal(fcf, fcd, decimal=6, err_msg='fch-fcd %s' % f) assert_almost_equal(fcl, fcd, decimal=15, err_msg='fch-fcl %s' % f) - @pytest.mark.xfail(IS_MUSL, reason="gh23049") @pytest.mark.xfail(IS_WASM, reason="doesn't work") def test_branch_cuts(self): # check branch cuts and continuity on them @@ -4173,7 +4162,6 @@ def test_branch_cuts(self): _check_branch_cut(np.arccosh, [0-2j, 2j, 2], [1, 1, 1j], 1, 1) _check_branch_cut(np.arctanh, [0-2j, 2j, 0], [1, 1, 1j], 1, 1) - @pytest.mark.xfail(IS_MUSL, reason="gh23049") @pytest.mark.xfail(IS_WASM, reason="doesn't work") def test_branch_cuts_complex64(self): # check branch cuts and continuity on them @@ -4227,7 +4215,6 @@ def test_against_cmath(self): _glibc_older_than("2.18"), reason="Older glibc versions are imprecise (maybe passes with SIMD?)" ) - @pytest.mark.xfail(IS_MUSL, reason="gh23049") @pytest.mark.xfail(IS_WASM, reason="doesn't work") @pytest.mark.parametrize('dtype', [ np.complex64, np.complex128, np.clongdouble