mirror of
https://github.com/python/cpython.git
synced 2025-10-30 13:11:29 +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
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue