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 /Lib/test/test_builtin.py | |
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 'Lib/test/test_builtin.py')
-rw-r--r-- | Lib/test/test_builtin.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index d56e6ff..f7b7c0c 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -816,6 +816,11 @@ class BuiltinTest(unittest.TestCase): self.assertEqual(int('0123', 0), 83) self.assertEqual(int('0x123', 16), 291) + # Bug 1679: "0x" is not a valid hex literal + self.assertRaises(ValueError, int, "0x", 16) + self.assertRaises(ValueError, int, "0x", 0) + + # SF bug 1334662: int(string, base) wrong answers # Various representations of 2**32 evaluated to 0 # rather than 2**32 in previous versions |