summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_contextlib.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2012-05-31 14:00:38 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2012-05-31 14:00:38 (GMT)
commita5bd2a18ce2bc0910357ff392b373174e0942e3b (patch)
tree971c4f021a10def114d5611f91db3f96aa508e20 /Lib/test/test_contextlib.py
parentc73e8c2830b8ab6983d8abd156de4ac8e22c3edd (diff)
downloadcpython-a5bd2a18ce2bc0910357ff392b373174e0942e3b.zip
cpython-a5bd2a18ce2bc0910357ff392b373174e0942e3b.tar.gz
cpython-a5bd2a18ce2bc0910357ff392b373174e0942e3b.tar.bz2
Close #14963: Use an iterative algorithm in contextlib.ExitStack.__exit__ (Patch by Alon Horev)
Diffstat (limited to 'Lib/test/test_contextlib.py')
-rw-r--r--Lib/test/test_contextlib.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py
index e5eed21..efa9dcb 100644
--- a/Lib/test/test_contextlib.py
+++ b/Lib/test/test_contextlib.py
@@ -572,6 +572,12 @@ class TestExitStack(unittest.TestCase):
stack.push(lambda *exc: 1/0)
stack.push(lambda *exc: {}[1])
+ def test_excessive_nesting(self):
+ # The original implementation would die with RecursionError here
+ with ExitStack() as stack:
+ for i in range(10000):
+ stack.callback(int)
+
def test_instance_bypass(self):
class Example(object): pass
cm = Example()