]> granicus.if.org Git - python/commitdiff
Issues #1621, #29145: Test for str.join() overflow
authorMartin Panter <vadmium+py@gmail.com>
Thu, 12 Jan 2017 11:54:59 +0000 (11:54 +0000)
committerMartin Panter <vadmium+py@gmail.com>
Thu, 12 Jan 2017 11:54:59 +0000 (11:54 +0000)
Lib/test/test_unicode.py

index f696a5bacf08035aba084b7ec485a629b343772b..3136ea1a1bad3eea9c60fc486ea5a7822b002cde 100644 (file)
@@ -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)