Fix #1679: "0x" was taken as a valid integer literal.

Fixes the tokenizer, tokenize.py and int() to reject this.
Patches by Malte Helmert.
This commit is contained in:
Georg Brandl 2008-01-19 19:27:05 +00:00
parent 2686f4d9d1
commit 14404b68d8
6 changed files with 45 additions and 16 deletions

View file

@ -1332,7 +1332,14 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end)
goto imaginary;
#endif
if (c == 'x' || c == 'X') {
/* Hex */
c = tok_nextc(tok);
if (!isxdigit(c)) {
tok->done = E_TOKEN;
tok_backup(tok, c);
return ERRORTOKEN;
}
do {
c = tok_nextc(tok);
} while (isxdigit(c));