mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Close #14963: Use an iterative algorithm in contextlib.ExitStack.__exit__ (Patch by Alon Horev)
This commit is contained in:
parent
c73e8c2830
commit
a5bd2a18ce
3 changed files with 29 additions and 28 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue