]> granicus.if.org Git - python/commitdiff
Issues #23363, #23364, #23365, #23366: Fixed itertools overflow tests.
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 2 Feb 2015 23:35:10 +0000 (01:35 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Mon, 2 Feb 2015 23:35:10 +0000 (01:35 +0200)
Used PyMem_New to check overflow.

1  2 
Lib/test/test_itertools.py
Modules/itertoolsmodule.c

index 207ee9e3d02596b88e4b140543898d1b1f46443c,bb3b61fdce2d21eeb2e82d7566a2845fd30080ef..244598b7529718520af5da2dfcd9a25d192528fe
@@@ -428,12 -420,10 +428,10 @@@ class TestBasicOps(unittest.TestCase)
  
      @support.bigaddrspacetest
      def test_permutations_overflow(self):
-         with self.assertRaises(OverflowError):
+         with self.assertRaises((OverflowError, MemoryError)):
              permutations("A", 2**30)
-         with self.assertRaises(OverflowError):
-             permutations("A", 2, 2**30)
  
 -    @support.impl_detail("tuple resuse is CPython specific")
 +    @support.impl_detail("tuple reuse is specific to CPython")
      def test_permutations_tuple_reuse(self):
          self.assertEqual(len(set(map(id, permutations('abcde', 3)))), 1)
          self.assertNotEqual(len(set(map(id, list(permutations('abcde', 3))))), 1)
Simple merge