mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 11:37:35 +00:00
d26d7ae0e4
Building o//third_party/python now takes 5 seconds on my PC This change works towards modifying Python to use runtime dispatching when appropriate. For example, when loading the magnums in the socket module, it's a good idea to check if the magnum is zero, because that means the local system platform doesn't support it.
21 lines
606 B
C
21 lines
606 B
C
#ifndef Py_PYFPE_H
|
|
#define Py_PYFPE_H
|
|
COSMOPOLITAN_C_START_
|
|
/* clang-format off */
|
|
#ifdef WANT_SIGFPE_HANDLER
|
|
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
|
|
COSMOPOLITAN_C_END_
|
|
#endif /* !Py_PYFPE_H */
|