[Python-bugs-list] [Bug #114630] Add fpectl functionality patch for FreeBSD

noreply@sourceforge.net noreply@sourceforge.net
Sun, 17 Sep 2000 08:04:54 -0700


Bug #114630, was updated on 2000-Sep-17 08:04
Here is a current snapshot of the bug.

Project: Python
Category: Core
Status: Open
Resolution: None
Bug Group: Platform-specific
Priority: 5
Summary: Add fpectl functionality patch for FreeBSD

Details: I'd have expected an "attach file" function on the bug page.  Not seeing one, I pasted the patch into the bug window.

--- Python-1.5.2/Modules/ORIG/fpectlmodule.c    Thu Dec 10 11:49:27 1998
+++ Python-1.5.2/Modules/fpectlmodule.c Sun Sep 17 10:44:17 2000
@@ -68,6 +68,10 @@
 #include "Python.h"
 #include <signal.h>
 
+#if defined(__FreeBSD__)
+#  include <ieeefp.h>
+#endif
+
 #ifndef WANT_SIGFPE_HANDLER
 /* Define locally if they are not defined in Python.  This gives only
  * the limited control to induce a core dump in case of an exception.
@@ -178,6 +182,12 @@
 #endif
     signal(SIGFPE, handler);
 
+/*-- FreeBSD ----------------------------------------------------------------*/
+#elif defined(__FreeBSD__)
+    fpresetsticky( fpgetsticky() );
+    fpsetmask( FP_X_INV | FP_X_DZ | FP_X_OFL );
+    signal( SIGFPE, handler );
+
 /*-- Linux ----------------------------------------------------------------*/
 #elif defined(linux)
 #ifdef __GLIBC__
@@ -212,7 +222,12 @@
 
 static PyObject *turnoff_sigfpe(PyObject *self,PyObject *args)
 {
+#ifdef __FreeBSD__
+    fpresetsticky( fpgetsticky() );
+    fpsetmask( 0 );
+#else
     fputs("Operation not implemented\n", stderr);
+#endif
     Py_INCREF (Py_None);
     return Py_None;
 }


For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=114630&group_id=5470