]> granicus.if.org Git - python/commitdiff
In atoi(), don't use isxdigit() to test whether the last character
authorGuido van Rossum <guido@python.org>
Mon, 22 Feb 1999 16:18:44 +0000 (16:18 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 22 Feb 1999 16:18:44 +0000 (16:18 +0000)
converted was a "digit" -- use isalnum().  This test is there only to
guard against "+" or "-" being interpreted as a valid int literal.
Reported by Takahiro Nakayama.

Modules/stropmodule.c

index 234a4dd42bed1667227c0bfd5271f57cd23c6504..4b8a501c31612c4510e9ebd8928b05be9ee0c01f 100644 (file)
@@ -818,7 +818,7 @@ strop_atoi(self, args)
                x = (long) PyOS_strtoul(s, &end, base);
        else
                x = PyOS_strtol(s, &end, base);
-       if (end == s || !isxdigit(end[-1]))
+       if (end == s || !isalnum(end[-1]))
                goto bad;
        while (*end && isspace(Py_CHARMASK(*end)))
                end++;