You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1015 B
58 lines
1015 B
10 years ago
|
# This tests that recursion with iternext doesn't lead to segfault.
|
||
8 years ago
|
try:
|
||
|
enumerate
|
||
|
filter
|
||
|
map
|
||
|
max
|
||
|
zip
|
||
|
except:
|
||
|
print("SKIP")
|
||
8 years ago
|
raise SystemExit
|
||
10 years ago
|
|
||
9 years ago
|
# We need to pick an N that is large enough to hit the recursion
|
||
|
# limit, but not too large that we run out of heap memory.
|
||
9 years ago
|
try:
|
||
9 years ago
|
# large stack/heap, eg unix
|
||
|
[0] * 80000
|
||
9 years ago
|
N = 2400
|
||
9 years ago
|
except:
|
||
9 years ago
|
try:
|
||
|
# medium, eg pyboard
|
||
|
[0] * 10000
|
||
|
N = 1000
|
||
|
except:
|
||
|
# small, eg esp8266
|
||
|
N = 100
|
||
9 years ago
|
|
||
10 years ago
|
try:
|
||
|
x = (1, 2)
|
||
9 years ago
|
for i in range(N):
|
||
10 years ago
|
x = enumerate(x)
|
||
|
tuple(x)
|
||
|
except RuntimeError:
|
||
|
print("RuntimeError")
|
||
|
|
||
|
try:
|
||
|
x = (1, 2)
|
||
9 years ago
|
for i in range(N):
|
||
10 years ago
|
x = filter(None, x)
|
||
|
tuple(x)
|
||
|
except RuntimeError:
|
||
|
print("RuntimeError")
|
||
|
|
||
|
try:
|
||
|
x = (1, 2)
|
||
9 years ago
|
for i in range(N):
|
||
10 years ago
|
x = map(max, x, ())
|
||
|
tuple(x)
|
||
|
except RuntimeError:
|
||
|
print("RuntimeError")
|
||
|
|
||
|
try:
|
||
|
x = (1, 2)
|
||
9 years ago
|
for i in range(N):
|
||
10 years ago
|
x = zip(x)
|
||
|
tuple(x)
|
||
|
except RuntimeError:
|
||
|
print("RuntimeError")
|