diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-02-02 23:35:10 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-02-02 23:35:10 (GMT) |
commit | b5e8e5755586820a278326e2aa55b8ff755f0a59 (patch) | |
tree | 2cf2fdc9b87fdb1dbd404798e0dce67478f57077 /Lib/test | |
parent | 4fdb68491e8b2d044c9173babf625bbb815c39d1 (diff) | |
parent | dee948b359c3a68ab4d6b81319eb2f3548b64c91 (diff) | |
download | cpython-b5e8e5755586820a278326e2aa55b8ff755f0a59.zip cpython-b5e8e5755586820a278326e2aa55b8ff755f0a59.tar.gz cpython-b5e8e5755586820a278326e2aa55b8ff755f0a59.tar.bz2 |
Issues #23363, #23364, #23365, #23366: Fixed itertools overflow tests.
Used PyMem_New to check overflow.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_itertools.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py index 207ee9e..244598b 100644 --- a/Lib/test/test_itertools.py +++ b/Lib/test/test_itertools.py @@ -266,7 +266,7 @@ class TestBasicOps(unittest.TestCase): @support.bigaddrspacetest def test_combinations_overflow(self): - with self.assertRaises(OverflowError): + with self.assertRaises((OverflowError, MemoryError)): combinations("AA", 2**29) # Test implementation detail: tuple re-use @@ -353,7 +353,7 @@ class TestBasicOps(unittest.TestCase): @support.bigaddrspacetest def test_combinations_with_replacement_overflow(self): - with self.assertRaises(OverflowError): + with self.assertRaises((OverflowError, MemoryError)): combinations_with_replacement("AA", 2**30) # Test implementation detail: tuple re-use @@ -428,10 +428,8 @@ 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 reuse is specific to CPython") def test_permutations_tuple_reuse(self): @@ -964,8 +962,8 @@ class TestBasicOps(unittest.TestCase): @support.bigaddrspacetest def test_product_overflow(self): - with self.assertRaises(OverflowError): - product(["a"]*(2**16), repeat=2**16) + with self.assertRaises((OverflowError, MemoryError)): + product(*(['ab']*2**5), repeat=2**25) @support.impl_detail("tuple reuse is specific to CPython") def test_product_tuple_reuse(self): |