From: Mark Lodato Date: Sat, 24 Oct 2009 18:40:41 +0000 (-0400) Subject: freeze: include FreeBSD fix from Python's main() X-Git-Tag: 0.12.alpha0~11^2~2^2~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=41e3105694644fa920c42ac2fe9f3a9a2f4395f5;p=cython.git freeze: include FreeBSD fix from Python's main() Copy the fix for floating point exceptions on FreeBSD from Python's Module/python.c. --- diff --git a/bin/cython_freeze b/bin/cython_freeze index 0709ee53..631c3924 100755 --- a/bin/cython_freeze +++ b/bin/cython_freeze @@ -41,6 +41,10 @@ print """\ #include #include +#ifdef __FreeBSD__ +#include +#endif + #if PY_MAJOR_VERSION < 3 # define MODINIT(name) init ## name #else @@ -77,6 +81,17 @@ if not options.pymain: int r = 0; """, print """\ + /* 754 requires that FP exceptions run in "no stop" mode by default, + * and until C vendors implement C99's ways to control FP exceptions, + * Python requires non-stop mode. Alas, some platforms enable FP + * exceptions by default. Here we disable them. + */ +#ifdef __FreeBSD__ + fp_except_t m; + + m = fpgetmask(); + fpsetmask(m & ~FP_X_OFL); +#endif if (PyImport_ExtendInittab(inittab)) { fprintf(stderr, "No memory\\n"); exit(1);