8000 Merge pull request #25092 from mbargull/fix-meson-HAVE_FEATURES_H · numpy/numpy@676534c · GitHub
[go: up one dir, main page]

Skip to content

Commit 676534c

Browse files
authored
Merge pull request #25092 from mbargull/fix-meson-HAVE_FEATURES_H
BLD: Fix features.h detection for Meson builds
2 parents 3b98c61 + 9ea36bf commit 676534c

File tree

3 files changed

+30
-21
lines changed

3 files changed

+30
-21
lines changed

numpy/_core/config.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#mesondefine HAVE___DECLSPEC_THREAD_
1313

1414
/* Optional headers */
15+
#mesondefine HAVE_FEATURES_H
1516
#mesondefine HAVE_XLOCALE_H
1617
#mesondefine HAVE_DLFCN_H
1718
#mesondefine HAVE_EXECINFO_H

numpy/_core/src/common/npy_config.h

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,29 @@
160160
#undef HAVE_CACOSHL
161161

162162
#endif /* __GLIBC_PREREQ(2, 18) */
163-
#endif /* defined(__GLIBC_PREREQ) */
163+
#else /* defined(__GLIBC) */
164+
/* musl linux?, see issue #25092 */
164165

166+
#undef HAVE_CASIN
167+
#undef HAVE_CASINF
168+
#undef HAVE_CASINL
169+
#undef HAVE_CASINH
170+
#undef HAVE_CASINHF
171+
#undef HAVE_CASINHL
172+
#undef HAVE_CATAN
173+
#undef HAVE_CATANF
174+
#undef HAVE_CATANL
175+
#undef HAVE_CATANH
176+
#undef HAVE_CATANHF
177+
#undef HAVE_CATANHL
178+
#undef HAVE_CACOS
179+
#undef HAVE_CACOSF
180+
#undef HAVE_CACOSL
181+
#undef HAVE_CACOSH
182+
#undef HAVE_CACOSHF
183+
#undef HAVE_CACOSHL
184+
185+
#endif /* defined(__GLIBC) */
165186
#endif /* defined(HAVE_FEATURES_H) */
166187

167188
#endif /* NUMPY_CORE_SRC_COMMON_NPY_CONFIG_H_ */

numpy/_core/tests/test_umath.py

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,21 +1354,9 @@ def test_log_values(self):
13541354

13551355
# test log() of max for dtype does not raise
13561356
for dt in ['f', 'd', 'g']:
1357-
try:
1358-
with np.errstate(all='raise'):
1359-
x = np.finfo(dt).max
1360-
np.log(x)
1361-
except FloatingPointError as exc:
1362-
if dt == 'g' and IS_MUSL:
1363-
# FloatingPointError is known to occur on longdouble
1364-
# for musllinux_x86_64 x is very large
1365-
pytest.skip(
1366-
"Overflow has occurred for"
1367-
" np.log(np.finfo(np.longdouble).max)"
1368-
)
1369-
else:
1370-
raise exc
1371-
1357+
with np.errstate(all='raise'):
1358+
x = np.finfo(dt).max
1359+
np.log(x)
13721360
def test_log_strides(self):
13731361
np.random.seed(42)
13741362
strides = np.array([-4,-3,-2,-1,1,2,3,4])
@@ -1712,6 +1700,9 @@ def test_arctanh(self):
17121700
assert_raises(FloatingPointError, np.arctanh,
17131701
np.array(value, dtype=dt))
17141702

1703+
# Make sure glibc < 2.18 atanh is not used, issue 25087
1704+
assert np.signbit(np.arctanh(-1j).real)
1705+
17151706
# See: https://github.com/numpy/numpy/issues/20448
17161707
@pytest.mark.xfail(
17171708
_glibc_older_than("2.17"),
@@ -1896,9 +1887,9 @@ def test_ldexp(self, dtype, stride):
18961887
class TestFRExp:
18971888
@pytest.mark.parametrize("stride", [-4,-2,-1,1,2,4])
18981889
@pytest.mark.parametrize("dtype", ['f', 'd'])
1899-
@pytest.mark.xfail(IS_MUSL, reason="gh23048")
19001890
@pytest.mark.skipif(not sys.platform.startswith('linux'),
19011891
reason="np.frexp gives different answers for NAN/INF on windows and linux")
1892+
@pytest.mark.xfail(IS_MUSL, reason="gh23049")
19021893
def test_frexp(self, dtype, stride):
19031894
arr = np.array([np.nan, np.nan, np.inf, -np.inf, 0.0, -0.0, 1.0, -1.0], dtype=dtype)
19041895
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):
41354126
assert_almost_equal(fz.real, fr, err_msg='real part %s' % f)
41364127
assert_almost_equal(fz.imag, 0., err_msg='imag part %s' % f)
41374128

4138-
@pytest.mark.xfail(IS_MUSL, reason="gh23049")
41394129
@pytest.mark.xfail(IS_WASM, reason="doesn't work")
41404130
def test_precisions_consistent(self):
41414131
z = 1 + 1j
@@ -4146,7 +4136,6 @@ def test_precisions_consistent(self):
41464136
assert_almost_equal(fcf, fcd, decimal=6, err_msg='fch-fcd %s' % f)
41474137
assert_almost_equal(fcl, fcd, decimal=15, err_msg='fch-fcl %s' % f)
41484138

4149-
@pytest.mark.xfail(IS_MUSL, reason="gh23049")
41504139
@pytest.mark.xfail(IS_WASM, reason="doesn't work")
41514140
def test_branch_cuts(self):
41524141
# check branch cuts and continuity on them
@@ -4173,7 +4162,6 @@ def test_branch_cuts(self):
41734162
_check_branch_cut(np.arccosh, [0-2j, 2j, 2], [1, 1, 1j], 1, 1)
41744163
_check_branch_cut(np.arctanh, [0-2j, 2j, 0], [1, 1, 1j], 1, 1)
41754164

4176-
@pytest.mark.xfail(IS_MUSL, reason="gh23049")
41774165
@pytest.mark.xfail(IS_WASM, reason="doesn't work")
41784166
def test_branch_cuts_complex64(self):
41794167
# check branch cuts and continuity on them
@@ -4227,7 +4215,6 @@ def test_against_cmath(self):
42274215
_glibc_older_than("2.18"),
42284216
reason="Older glibc versions are imprecise (maybe passes with SIMD?)"
42294217
)
4230-
@pytest.mark.xfail(IS_MUSL, reason="gh23049")
42314218
@pytest.mark.xfail(IS_WASM, reason="doesn't work")
42324219
@pytest.mark.parametrize('dtype', [
42334220
np.complex64, np.complex128, np.clongdouble

0 commit comments

Comments
 (0)
0