tests: Add test for recursive iternext stack overflow.
This commit is contained in:
parent
953c23b1bc
commit
80f638fe19
2 changed files with 37 additions and 0 deletions
33
tests/misc/recursive_iternext.py
Normal file
33
tests/misc/recursive_iternext.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# This tests that recursion with iternext doesn't lead to segfault.
|
||||
|
||||
try:
|
||||
x = (1, 2)
|
||||
for i in range(1000):
|
||||
x = enumerate(x)
|
||||
tuple(x)
|
||||
except RuntimeError:
|
||||
print("RuntimeError")
|
||||
|
||||
try:
|
||||
x = (1, 2)
|
||||
for i in range(1000):
|
||||
x = filter(None, x)
|
||||
tuple(x)
|
||||
except RuntimeError:
|
||||
print("RuntimeError")
|
||||
|
||||
try:
|
||||
x = (1, 2)
|
||||
for i in range(1000):
|
||||
x = map(max, x, ())
|
||||
tuple(x)
|
||||
except RuntimeError:
|
||||
print("RuntimeError")
|
||||
|
||||
try:
|
||||
x = (1, 2)
|
||||
for i in range(1000):
|
||||
x = zip(x)
|
||||
tuple(x)
|
||||
except RuntimeError:
|
||||
print("RuntimeError")
|
||||
4
tests/misc/recursive_iternext.py.exp
Normal file
4
tests/misc/recursive_iternext.py.exp
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
RuntimeError
|
||||
RuntimeError
|
||||
RuntimeError
|
||||
RuntimeError
|
||||
Loading…
Reference in a new issue