summaryrefslogtreecommitdiffstats
path: root/Python/strtod.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-12-31 13:15:19 (GMT)
committerGuido van Rossum <guido@python.org>1991-12-31 13:15:19 (GMT)
commit5afc74757bae4a7274a5db0888985cd84ed92d32 (patch)
treed6a20c1bdcd47c4ec9e67d050a0247af8f199056 /Python/strtod.c
parenta534ed3ee79726e2879c630eddd796249dcfb1df (diff)
downloadcpython-5afc74757bae4a7274a5db0888985cd84ed92d32.zip
cpython-5afc74757bae4a7274a5db0888985cd84ed92d32.tar.gz
cpython-5afc74757bae4a7274a5db0888985cd84ed92d32.tar.bz2
Clear errno, just to be sure.
Diffstat (limited to 'Python/strtod.c')
-rw-r--r--Python/strtod.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Python/strtod.c b/Python/strtod.c
index d41b690..e3fb81b 100644
--- a/Python/strtod.c
+++ b/Python/strtod.c
@@ -1,6 +1,8 @@
/* This is not a proper strtod() implementation, but sufficient for Python.
Python won't detect floating point constant overflow, though. */
+extern int errno;
+
extern int strlen();
extern double atof();
@@ -9,7 +11,12 @@ strtod(p, pp)
char *p;
char **pp;
{
+ double res;
+
if (pp)
*pp = p + strlen(p);
- return atof(p);
+ res = atof(p);
+ errno = 0;
+ return res;
+
}