From: Martin Panter Date: Thu, 12 Jan 2017 11:54:59 +0000 (+0000) Subject: Issues #1621, #29145: Test for str.join() overflow X-Git-Tag: v3.6.1rc1~172^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b71c0956d0904cfdc271cd10d40385c730cf8bcb;p=thirdparty%2FPython%2Fcpython.git Issues #1621, #29145: Test for str.join() overflow --- diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index f696a5bacf08..3136ea1a1bad 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)