diff options
author | Georg Brandl <georg@python.org> | 2007-03-06 18:41:12 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-03-06 18:41:12 (GMT) |
commit | 00cd818dea72177dd79a3d86562d52f1433f9f49 (patch) | |
tree | 19b02cfa57feb0ad0e4f2ecb35f7aeac1acb59cf /Lib | |
parent | 1579265aac467db8368676dff6757a46361a1c01 (diff) | |
download | cpython-00cd818dea72177dd79a3d86562d52f1433f9f49.zip cpython-00cd818dea72177dd79a3d86562d52f1433f9f49.tar.gz cpython-00cd818dea72177dd79a3d86562d52f1433f9f49.tar.bz2 |
Patch #1638879: don't accept strings with embedded NUL bytes in long().
Diffstat (limited to 'Lib')
-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 72b6966..da2afba 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -1017,6 +1017,11 @@ class BuiltinTest(unittest.TestCase): self.assertRaises(ValueError, long, '53', 40) self.assertRaises(TypeError, long, 1, 12) + # SF patch #1638879: embedded NULs were not detected with + # explicit base + self.assertRaises(ValueError, long, '123\0', 10) + self.assertRaises(ValueError, long, '123\x00 245', 20) + self.assertEqual(long('100000000000000000000000000000000', 2), 4294967296) self.assertEqual(long('102002022201221111211', 3), 4294967296) |