mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Changes for Lee Busby's SIGFPE patch set.
Two new modules fpectl and fpetest. Surround various and sundry f.p. operations with PyFPE_*_PROTECT macros.
This commit is contained in:
parent
0ae748d3c4
commit
52fa3a6909
8 changed files with 492 additions and 1 deletions
|
@ -80,7 +80,9 @@ math_1(args, func)
|
|||
if (! PyArg_Parse(args, "d", &x))
|
||||
return NULL;
|
||||
errno = 0;
|
||||
PyFPE_START_PROTECT("in math_1", return 0)
|
||||
x = (*func)(x);
|
||||
PyFPE_END_PROTECT
|
||||
CHECK(x);
|
||||
if (errno != 0)
|
||||
return math_error();
|
||||
|
@ -97,7 +99,9 @@ math_2(args, func)
|
|||
if (! PyArg_Parse(args, "(dd)", &x, &y))
|
||||
return NULL;
|
||||
errno = 0;
|
||||
PyFPE_START_PROTECT("in math_2", return 0)
|
||||
x = (*func)(x, y);
|
||||
PyFPE_END_PROTECT
|
||||
CHECK(x);
|
||||
if (errno != 0)
|
||||
return math_error();
|
||||
|
@ -173,7 +177,9 @@ math_ldexp(self, args)
|
|||
if (! PyArg_Parse(args, "(dd)", &x, &y))
|
||||
return NULL;
|
||||
errno = 0;
|
||||
PyFPE_START_PROTECT("ldexp", return 0)
|
||||
x = ldexp(x, (int)y);
|
||||
PyFPE_END_PROTECT
|
||||
CHECK(x);
|
||||
if (errno != 0)
|
||||
return math_error();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue