mirror of
https://github.com/python/cpython.git
synced 2025-09-13 12:17:24 +00:00
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:
parent
2686f4d9d1
commit
14404b68d8
6 changed files with 45 additions and 16 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue