diff options
author | Georg Brandl <georg@python.org> | 2008-01-19 19:27:05 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-01-19 19:27:05 (GMT) |
commit | 14404b68d8c5a501a2f5ee6f45494865b7b38276 (patch) | |
tree | f1db16ee7f39d81414ad24bd682e9df61b74e4dd /Parser | |
parent | 2686f4d9d14e2b30a61e5350dcb4a56c43c82b57 (diff) | |
download | cpython-14404b68d8c5a501a2f5ee6f45494865b7b38276.zip cpython-14404b68d8c5a501a2f5ee6f45494865b7b38276.tar.gz cpython-14404b68d8c5a501a2f5ee6f45494865b7b38276.tar.bz2 |
Fix #1679: "0x" was taken as a valid integer literal.
Fixes the tokenizer, tokenize.py and int() to reject this.
Patches by Malte Helmert.
Diffstat (limited to 'Parser')
-rw-r--r-- | Parser/tokenizer.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index 0015dae..0aaec19 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -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)); |