diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2008-08-21 21:40:15 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2008-08-21 21:40:15 (GMT) |
commit | 42a72ee181aa604154862d85768b32ae805aa79e (patch) | |
tree | e7774d4760c052aaecbd90524b1a1c86a45965f1 /Objects | |
parent | 589b795986760cbe391d70b33bfd5ca424eabdb1 (diff) | |
download | cpython-42a72ee181aa604154862d85768b32ae805aa79e.zip cpython-42a72ee181aa604154862d85768b32ae805aa79e.tar.gz cpython-42a72ee181aa604154862d85768b32ae805aa79e.tar.bz2 |
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.
........
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/floatobject.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c index 8cebc9f..63d67ab 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -1041,7 +1041,6 @@ char_from_hex(int x) static int hex_from_char(char c) { int x; - assert(isxdigit(c)); switch(c) { case '0': x = 0; @@ -1271,12 +1270,12 @@ float_fromhex(PyObject *cls, PyObject *arg) /* 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 @@ float_fromhex(PyObject *cls, PyObject *arg) 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); } |