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
commitf032a002711083610bf732bdfc5034e3af739ebe (patch)
treec8f0f0d4ad8a1873a410f7a268189e28aa0e4a05 /Python/pystrtod.c
parent1e8fba729e218bc4b2e1ed3104f8cdbd88fdb21a (diff)
downloadcpython-git-f032a002711083610bf732bdfc5034e3af739ebe.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;