summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_builtin.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r--Lib/test/test_builtin.py34
1 files changed, 33 insertions, 1 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index c342a43..b473b00 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -1565,8 +1565,40 @@ class TestSorted(unittest.TestCase):
data = 'The quick Brown fox Jumped over The lazy Dog'.split()
self.assertRaises(TypeError, sorted, data, None, lambda x,y: 0)
+class TestRecursionLimit(unittest.TestCase):
+ # Issue #14010
+ recursionlimit = sys.getrecursionlimit()
+
+ def test_filter(self):
+ it = (0, 1)
+ for _ in range(self.recursionlimit):
+ it = filter(bool, it)
+ with self.assertRaises(RuntimeError):
+ for _ in it:
+ pass
+ del it
+
+ def test_map(self):
+ it = (0, 1)
+ for _ in range(self.recursionlimit):
+ it = map(int, it)
+ with self.assertRaises(RuntimeError):
+ for _ in it:
+ pass
+ del it
+
+ def test_zip(self):
+ it = (0, 1)
+ for _ in range(self.recursionlimit):
+ it = zip(it)
+ with self.assertRaises(RuntimeError):
+ for _ in it:
+ pass
+ del it
+
+
def test_main(verbose=None):
- test_classes = (BuiltinTest, TestSorted)
+ test_classes = (BuiltinTest, TestSorted, TestRecursionLimit)
run_unittest(*test_classes)