summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_itertools.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-02-02 23:50:31 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-02-02 23:50:31 (GMT)
commit7a27c97216ef1a71bc26a559d7331523875a0c6f (patch)
tree9eddc670b521a45b275d3944812f16ea501b2540 /Lib/test/test_itertools.py
parent83848704f550912fe559988d6de0b5105844d75f (diff)
parentb5e8e5755586820a278326e2aa55b8ff755f0a59 (diff)
downloadcpython-7a27c97216ef1a71bc26a559d7331523875a0c6f.zip
cpython-7a27c97216ef1a71bc26a559d7331523875a0c6f.tar.gz
cpython-7a27c97216ef1a71bc26a559d7331523875a0c6f.tar.bz2
Issues #23363, #23364, #23365, #23366: Fixed itertools overflow tests.
Used PyMem_New to check overflow.
Diffstat (limited to 'Lib/test/test_itertools.py')
-rw-r--r--Lib/test/test_itertools.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index d0167e5..6a0130e 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):