2015-06-03 21:41:06 +00:00
|
|
|
# This tests that recursion with iternext doesn't lead to segfault.
|
2017-03-11 00:16:26 +00:00
|
|
|
try:
|
|
|
|
enumerate
|
|
|
|
filter
|
|
|
|
map
|
|
|
|
max
|
|
|
|
zip
|
|
|
|
except:
|
|
|
|
print("SKIP")
|
2017-06-10 17:14:16 +00:00
|
|
|
raise SystemExit
|
2015-06-03 21:41:06 +00:00
|
|
|
|
2016-06-03 14:09:45 +00:00
|
|
|
# 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.
|
2016-02-13 13:50:22 +00:00
|
|
|
try:
|
2016-06-03 14:09:45 +00:00
|
|
|
# large stack/heap, eg unix
|
|
|
|
[0] * 80000
|
2019-07-17 05:33:27 +00:00
|
|
|
N = 5000
|
2016-02-13 13:50:22 +00:00
|
|
|
except:
|
2016-06-03 14:09:45 +00:00
|
|
|
try:
|
|
|
|
# medium, eg pyboard
|
|
|
|
[0] * 10000
|
|
|
|
N = 1000
|
|
|
|
except:
|
|
|
|
# small, eg esp8266
|
|
|
|
N = 100
|
2016-02-13 13:50:22 +00:00
|
|
|
|
2015-06-03 21:41:06 +00:00
|
|
|
try:
|
|
|
|
x = (1, 2)
|
2016-02-13 13:50:22 +00:00
|
|
|
for i in range(N):
|
2015-06-03 21:41:06 +00:00
|
|
|
x = enumerate(x)
|
|
|
|
tuple(x)
|
|
|
|
except RuntimeError:
|
|
|
|
print("RuntimeError")
|
|
|
|
|
|
|
|
try:
|
|
|
|
x = (1, 2)
|
2016-02-13 13:50:22 +00:00
|
|
|
for i in range(N):
|
2015-06-03 21:41:06 +00:00
|
|
|
x = filter(None, x)
|
|
|
|
tuple(x)
|
|
|
|
except RuntimeError:
|
|
|
|
print("RuntimeError")
|
|
|
|
|
|
|
|
try:
|
|
|
|
x = (1, 2)
|
2016-02-13 13:50:22 +00:00
|
|
|
for i in range(N):
|
2015-06-03 21:41:06 +00:00
|
|
|
x = map(max, x, ())
|
|
|
|
tuple(x)
|
|
|
|
except RuntimeError:
|
|
|
|
print("RuntimeError")
|
|
|
|
|
|
|
|
try:
|
|
|
|
x = (1, 2)
|
2016-02-13 13:50:22 +00:00
|
|
|
for i in range(N):
|
2015-06-03 21:41:06 +00:00
|
|
|
x = zip(x)
|
|
|
|
tuple(x)
|
|
|
|
except RuntimeError:
|
|
|
|
print("RuntimeError")
|