summaryrefslogtreecommitdiff
path: root/Python/pystrtod.c
diff options
context:
space:
mode:
authorEric Smith <eric@trueblade.com>2008-07-19 00:24:05 +0000
committerEric Smith <eric@trueblade.com>2008-07-19 00:24:05 +0000
commitda202ffe5a4a0ffdfa642dafc555164cdb6df17d (patch)
tree0ced8c69ae44643d4ecd2465a1ccff5e67dffeac /Python/pystrtod.c
parentc1d55b24551890ee7ee416aa2b9b5fc0f2a3e3d8 (diff)
downloadcpython-da202ffe5a4a0ffdfa642dafc555164cdb6df17d.tar.gz
Fix issue 3411: default float format spec fails on negative numbers.
Diffstat (limited to 'Python/pystrtod.c')
-rw-r--r--Python/pystrtod.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/pystrtod.c b/Python/pystrtod.c
index 01c1c42770..302e01298a 100644
--- a/Python/pystrtod.c
+++ b/Python/pystrtod.c
@@ -302,6 +302,10 @@ ensure_decimal_point(char* buffer, size_t buf_size)
/* search for the first non-digit character */
char *p = buffer;
+ if (*p == '-' || *p == '+')
+ /* Skip leading sign, if present. I think this could only
+ ever be '-', but it can't hurt to check for both. */
+ ++p;
while (*p && isdigit(Py_CHARMASK(*p)))
++p;