(user_routine *)0,
_ABORT_ON_ERROR,
NULL);
- signal(SIGFPE, handler);
+ PyOS_setsig(SIGFPE, handler);
/*-- SunOS and Solaris ----------------------------------------------------*/
#elif defined(sun)
(void) nonstandard_arithmetic();
(void) ieee_flags("clearall",mode,in,&out);
(void) ieee_handler("set","common",(sigfpe_handler_type)handler);
- signal(SIGFPE, handler);
+ PyOS_setsig(SIGFPE, handler);
/*-- HPUX -----------------------------------------------------------------*/
#elif defined(__hppa) || defined(hppa)
/* ld -b -o fpectlmodule.sl fpectlmodule.o -lm */
#include <math.h>
fpsetdefaults();
- signal(SIGFPE, handler);
+ PyOS_setsig(SIGFPE, handler);
/*-- IBM AIX --------------------------------------------------------------*/
#elif defined(__AIX) || defined(_AIX)
#include <fptrap.h>
fp_trap(FP_TRAP_SYNC);
fp_enable(TRP_INVALID | TRP_DIV_BY_ZERO | TRP_OVERFLOW);
- signal(SIGFPE, handler);
+ PyOS_setsig(SIGFPE, handler);
/*-- DEC ALPHA OSF --------------------------------------------------------*/
#elif defined(__alpha) && defined(__osf__)
unsigned long fp_control =
IEEE_TRAP_ENABLE_INV | IEEE_TRAP_ENABLE_DZE | IEEE_TRAP_ENABLE_OVF;
ieee_set_fp_control(fp_control);
- signal(SIGFPE, handler);
+ PyOS_setsig(SIGFPE, handler);
/*-- Cray Unicos ----------------------------------------------------------*/
#elif defined(cray)
#ifdef HAS_LIBMSET
libmset(-1);
#endif
- signal(SIGFPE, handler);
+ PyOS_setsig(SIGFPE, handler);
/*-- FreeBSD ----------------------------------------------------------------*/
#elif defined(__FreeBSD__)
- fpresetsticky( fpgetsticky() );
- fpsetmask( FP_X_INV | FP_X_DZ | FP_X_OFL );
- signal( SIGFPE, handler );
+ fpresetsticky(fpgetsticky());
+ fpsetmask(FP_X_INV | FP_X_DZ | FP_X_OFL);
+ PyOS_setsig(SIGFPE, handler);
/*-- Linux ----------------------------------------------------------------*/
#elif defined(linux)
#include <i386/fpu_control.h>
#endif
__setfpucw(0x1372);
- signal(SIGFPE, handler);
+ PyOS_setsig(SIGFPE, handler);
/*-- NeXT -----------------------------------------------------------------*/
#elif defined(NeXT) && defined(m68k) && defined(__GNUC__)
/* NeXT needs explicit csr set to generate SIGFPE */
asm("fmovel #0x1400,fpcr"); /* set OVFL and ZD bits */
- signal(SIGFPE, handler);
+ PyOS_setsig(SIGFPE, handler);
/*-- Microsoft Windows, NT ------------------------------------------------*/
#elif defined(_MSC_VER)
#include <float.h>
unsigned int cw = _EM_INVALID | _EM_ZERODIVIDE | _EM_OVERFLOW;
(void)_controlfp(0, cw);
- signal(SIGFPE, handler);
+ PyOS_setsig(SIGFPE, handler);
/*-- Give Up --------------------------------------------------------------*/
#else
static PyObject *turnoff_sigfpe(PyObject *self,PyObject *args)
{
#ifdef __FreeBSD__
- fpresetsticky( fpgetsticky() );
- fpsetmask( 0 );
+ fpresetsticky(fpgetsticky());
+ fpsetmask(0);
#else
fputs("Operation not implemented\n", stderr);
#endif
- Py_INCREF (Py_None);
+ Py_INCREF(Py_None);
return Py_None;
}