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

@ -50,7 +50,7 @@ def maybe(*choices): return group(*choices) + '?'
Ignore = Whitespace + any(r'\\\r?\n' + Whitespace) + maybe(Comment)
Name = r'[a-zA-Z_]\w*'
Hexnumber = r'0[xX][\da-fA-F]*[lL]?'
Hexnumber = r'0[xX][\da-fA-F]+[lL]?'
Octnumber = r'0[0-7]*[lL]?'
Decnumber = r'[1-9]\d*[lL]?'
Intnumber = group(Hexnumber, Octnumber, Decnumber)