Skip to content

Commit 7172f50

Browse files
committed
Replace fpgetmask() with fedisableexcept()
Issue python#24520: On FreeBSD, fpgetmask() was deprecated long time ago. fedisableexcept() is now preferred.
1 parent 6a0514e commit 7172f50

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Programs/python.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <locale.h>
55

66
#ifdef __FreeBSD__
7-
#include <floatingpoint.h>
7+
#include <fenv.h>
88
#endif
99

1010
#ifdef MS_WINDOWS
@@ -23,9 +23,6 @@ main(int argc, char **argv)
2323
wchar_t **argv_copy2;
2424
int i, res;
2525
char *oldloc;
26-
#ifdef __FreeBSD__
27-
fp_except_t m;
28-
#endif
2926

3027
argv_copy = (wchar_t **)PyMem_RawMalloc(sizeof(wchar_t*) * (argc+1));
3128
argv_copy2 = (wchar_t **)PyMem_RawMalloc(sizeof(wchar_t*) * (argc+1));
@@ -40,8 +37,7 @@ main(int argc, char **argv)
4037
* exceptions by default. Here we disable them.
4138
*/
4239
#ifdef __FreeBSD__
43-
m = fpgetmask();
44-
fpsetmask(m & ~FP_X_OFL);
40+
fedisableexcept(FE_OVERFLOW);
4541
#endif
4642

4743
oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL));

0 commit comments

Comments
 (0)