mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +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
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue