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

@ -30,6 +30,8 @@ class TokenTests(unittest.TestCase):
self.assertEquals(0xff, 255)
self.assertEquals(0377, 255)
self.assertEquals(2147483647, 017777777777)
# "0x" is not a valid literal
self.assertRaises(SyntaxError, eval, "0x")
from sys import maxint
if maxint == 2147483647:
self.assertEquals(-2147483647-1, -020000000000)