mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
Patch #1638879: don't accept strings with embedded NUL bytes in long().
This commit is contained in:
parent
1579265aac
commit
00cd818dea
3 changed files with 25 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue