Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit b71c095

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

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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)