Mercurial > cpython-lru_cache-weakref
diff Objects/floatobject.c @ 48819:a8d69c1a3f4e
Merged revisions 65964 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r65964 | mark.dickinson | 2008-08-21 22:38:38 +0100 (Thu, 21 Aug 2008) | 7 lines
issue 3633: Solaris allows fullwidth Unicode digits in isxdigit, so
rewrite float.fromhex to only allow ASCII hex digits on all platforms.
(Tests for this are already present, but the test_float failures
on Solaris hadn't been noticed before.)
Reviewed by Antoine Pitrou.
........
| author | Mark Dickinson <dickinsm@gmail.com> |
|---|---|
| date | Thu, 21 Aug 2008 21:40:15 +0000 |
| parents | 89538d5fb81a |
| children | e86ed113535c |
line wrap: on
line diff
--- a/Objects/floatobject.c Thu Aug 21 20:05:56 2008 +0000 +++ b/Objects/floatobject.c Thu Aug 21 21:40:15 2008 +0000 @@ -1041,7 +1041,6 @@ static int hex_from_char(char c) { int x; - assert(isxdigit(c)); switch(c) { case '0': x = 0; @@ -1271,12 +1270,12 @@ /* coefficient: <integer> [. <fraction>] */ coeff_start = s; - while (isxdigit(*s)) + while (hex_from_char(*s) >= 0) s++; s_store = s; if (*s == '.') { s++; - while (isxdigit(*s)) + while (hex_from_char(*s) >= 0) s++; coeff_end = s-1; } @@ -1298,10 +1297,10 @@ exp_start = s; if (*s == '-' || *s == '+') s++; - if (!isdigit(*s)) + if (!('0' <= *s && *s <= '9')) goto parse_error; s++; - while (isdigit(*s)) + while ('0' <= *s && *s <= '9') s++; exp = strtol(exp_start, NULL, 10); }
