123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- #ifndef Py_PYFPE_H
- #define Py_PYFPE_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- #ifdef WANT_SIGFPE_HANDLER
- #include <signal.h>
- #include <setjmp.h>
- #include <math.h>
- extern jmp_buf PyFPE_jbuf;
- extern int PyFPE_counter;
- extern double PyFPE_dummy(void *);
- #define PyFPE_START_PROTECT(err_string, leave_stmt) \
- if (!PyFPE_counter++ && setjmp(PyFPE_jbuf)) { \
- PyErr_SetString(PyExc_FloatingPointError, err_string); \
- PyFPE_counter = 0; \
- leave_stmt; \
- }
- #define PyFPE_END_PROTECT(v) PyFPE_counter -= (int)PyFPE_dummy(&(v));
- #else
- #define PyFPE_START_PROTECT(err_string, leave_stmt)
- #define PyFPE_END_PROTECT(v)
- #endif
- #ifdef __cplusplus
- }
- #endif
- #endif
|