summaryrefslogtreecommitdiffstats
path: root/Python/marshal.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-02-14 22:58:07 (GMT)
committerGuido van Rossum <guido@python.org>1997-02-14 22:58:07 (GMT)
commit0ae748d3c409fc4b870baadd601a53c6a43ddf11 (patch)
treef2f51f02dae2969fdf958a28e9412da3092eddd3 /Python/marshal.c
parent09e6ad0c1e1c7b3c6132ab2d5dd85c5cc376721d (diff)
downloadcpython-0ae748d3c409fc4b870baadd601a53c6a43ddf11.zip
cpython-0ae748d3c409fc4b870baadd601a53c6a43ddf11.tar.gz
cpython-0ae748d3c409fc4b870baadd601a53c6a43ddf11.tar.bz2
Changes for Lee Busby's SIGFPE patch set.
New file pyfpe.c and exception FloatingPointError. Surround some f.p. operations with PyFPE macro brackets.
Diffstat (limited to 'Python/marshal.c')
-rw-r--r--Python/marshal.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/Python/marshal.c b/Python/marshal.c
index 0ad493a..f4634f0 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -412,6 +412,7 @@ r_object(p)
{
extern double atof PROTO((const char *));
char buf[256];
+ double dx;
n = r_byte(p);
if (r_string(buf, (int)n, p) != n) {
err_setstr(EOFError,
@@ -419,7 +420,10 @@ r_object(p)
return NULL;
}
buf[n] = '\0';
- return newfloatobject(atof(buf));
+ PyFPE_START_PROTECT("atof", return 0)
+ dx = atof(buf);
+ PyFPE_END_PROTECT
+ return newfloatobject(dx);
}
#ifndef WITHOUT_COMPLEX
@@ -435,7 +439,9 @@ r_object(p)
return NULL;
}
buf[n] = '\0';
+ PyFPE_START_PROTECT("atof", return 0)
c.real = atof(buf);
+ PyFPE_END_PROTECT
n = r_byte(p);
if (r_string(buf, (int)n, p) != n) {
err_setstr(EOFError,
@@ -443,7 +449,9 @@ r_object(p)
return NULL;
}
buf[n] = '\0';
+ PyFPE_START_PROTECT("atof", return 0)
c.imag = atof(buf);
+ PyFPE_END_PROTECT
return newcomplexobject(c);
}
#endif