Bug #1545497: when given an explicit base, int() did ignore NULs

embedded in the string to convert.
This commit is contained in:
Georg Brandl 2006-10-12 11:27:59 +00:00
parent 7d74a0e287
commit 2c1375c8db
3 changed files with 27 additions and 2 deletions

View file

@ -729,6 +729,11 @@ class BuiltinTest(unittest.TestCase):
self.assertRaises(ValueError, int, '123\0')
self.assertRaises(ValueError, int, '53', 40)
# SF bug 1545497: embedded NULs were not detected with
# explicit base
self.assertRaises(ValueError, int, '123\0', 10)
self.assertRaises(ValueError, int, '123\x00 245', 20)
x = int('1' * 600)
self.assert_(isinstance(x, long))