Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b71c095

Browse files
committed
Issues #1621, #29145: Test for str.join() overflow
1 parent 52e2907 commit b71c095

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Lib/test/test_unicode.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,13 @@ def __str__(self): return self.sval
464464
self.checkraises(TypeError, ' ', 'join', [1, 2, 3])
465465
self.checkraises(TypeError, ' ', 'join', ['1', '2', 3])
466466

467+
@unittest.skipIf(sys.maxsize > 2**32,
468+
'needs too much memory on a 64-bit platform')
469+
def test_join_overflow(self):
470+
size = int(sys.maxsize**0.5) + 1
471+
seq = ('A' * size,) * size
472+
self.assertRaises(OverflowError, ''.join, seq)
473+
467474
def test_replace(self):
468475
string_tests.CommonTest.test_replace(self)
469476

0 commit comments

Comments
 (0)