8000 Merge pull request #19209 from r-devulap/glibc-ver-2.17 · numpy/numpy@b5cc1f8 · GitHub
[go: up one dir, main page]

Skip to content

Commit b5cc1f8

Browse files
authored
Merge pull request #19209 from r-devulap/glibc-ver-2.17
TST: Ignore exp FP exceptions test for glibc ver < 2.17
2 parents d3ff4e0 + 167a2c7 commit b5cc1f8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

numpy/core/tests/test_umath.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import itertools
55
import pytest
66
import sys
7+
import os
78
from fractions import Fraction
89
from functools import reduce
910

@@ -17,6 +18,20 @@
1718
_gen_alignment_data, assert_array_almost_equal_nulp, assert_warns
1819
)
1920

21+
def get_glibc_version():
22+
try:
23+
ver = os.confstr('CS_GNU_LIBC_VERSION').rsplit(' ')[1]
24+
except Exception as inst:
25+
ver = '0.0'
26+
27+
return ver
28+
29+
30+
glibcver = get_glibc_version()
31+
glibc_newerthan_2_17 = pytest.mark.xfail(
32+
glibcver != '0.0' and glibcver < '2.17',
33+
reason="Older glibc versions may not raise appropriate FP exceptions")
34+
2035
def on_powerpc():
2136
""" True if we are running on a Power PC platform."""
2237
return platform.processor() == 'powerpc' or \
@@ -986,6 +1001,10 @@ def test_exp_values(self):
9861001
yf = np.array(y, dtype=dt)
9871002
assert_equal(np.exp(yf), xf)
9881003

1004+
# Older version of glibc may not raise the correct FP exceptions
1005+
# See: https://github.com/numpy/numpy/issues/19192
1006+
@glibc_newerthan_2_17
1007+
def test_exp_exceptions(self):
9891008
with np.errstate(over='raise'):
9901009
assert_raises(FloatingPointError, np.exp, np.float32(100.))
9911010
assert_raises(FloatingPointError, np.exp, np.float32(1E19))

0 commit comments

Comments
 (0)
0