From b71c0956d0904cfdc271cd10d40385c730cf8bcb Mon Sep 17 00:00:00 2001 From: Martin Panter Date: Thu, 12 Jan 2017 11:54:59 +0000 Subject: [PATCH] Issues #1621, #29145: Test for str.join() overflow --- Lib/test/test_unicode.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index f696a5bacf..3136ea1a1b 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -464,6 +464,13 @@ class UnicodeTest(string_tests.CommonTest, self.checkraises(TypeError, ' ', 'join', [1, 2, 3]) self.checkraises(TypeError, ' ', 'join', ['1', '2', 3]) + @unittest.skipIf(sys.maxsize > 2**32, + 'needs too much memory on a 64-bit platform') + def test_join_overflow(self): + size = int(sys.maxsize**0.5) + 1 + seq = ('A' * size,) * size + self.assertRaises(OverflowError, ''.join, seq) + def test_replace(self): string_tests.CommonTest.test_replace(self) -- 2.40.0