tests: Add test for recursive iternext stack overflow.

pull/1305/head
Damien George 2015-06-03 22:41:06 +01:00
rodzic 953c23b1bc
commit 80f638fe19
2 zmienionych plików z 37 dodań i 0 usunięć

Wyświetl plik

@ -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")

Wyświetl plik

@ -0,0 +1,4 @@
RuntimeError
RuntimeError
RuntimeError
RuntimeError