mirror of
https://github.com/python/cpython
synced 2026-09-29 11:55:30 +03:00
Changes for Lee Busby's SIGFPE patch set.
New file pyfpe.c and exception FloatingPointError. Surround some f.p. operations with PyFPE macro brackets.
This commit is contained in:
parent
09e6ad0c1e
commit
0ae748d3c4
5 changed files with 38 additions and 4 deletions
|
|
@ -782,6 +782,7 @@ parsenumber(co, s)
|
|||
extern double atof PROTO((const char *));
|
||||
char *end;
|
||||
long x;
|
||||
double dx;
|
||||
#ifndef WITHOUT_COMPLEX
|
||||
Py_complex c;
|
||||
int imflag;
|
||||
|
|
@ -810,12 +811,18 @@ parsenumber(co, s)
|
|||
#ifndef WITHOUT_COMPLEX
|
||||
if (imflag) {
|
||||
c.real = 0.;
|
||||
PyFPE_START_PROTECT("atof", return 0)
|
||||
c.imag = atof(s);
|
||||
PyFPE_END_PROTECT
|
||||
return newcomplexobject(c);
|
||||
}
|
||||
else
|
||||
else {
|
||||
#endif
|
||||
return newfloatobject(atof(s));
|
||||
PyFPE_START_PROTECT("atof", return 0)
|
||||
dx = atof(s);
|
||||
PyFPE_END_PROTECT
|
||||
return newfloatobject(dx);
|
||||
}
|
||||
}
|
||||
|
||||
static object *
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue