blob: bbc389e726237a5e3dea0833e97c5c43a88e8266 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# This tests that recursion with iternext doesn't lead to segfault.
try:
enumerate
filter
map
max
zip
except:
print("SKIP")
raise SystemExit
# 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.
try:
# large stack/heap, eg unix
[0] * 80000
N = 5000
except:
try:
# medium, eg pyboard
[0] * 10000
N = 1000
except:
# small, eg esp8266
N = 100
try:
x = (1, 2)
for i in range(N):
x = enumerate(x)
tuple(x)
except RuntimeError:
print("RuntimeError")
try:
x = (1, 2)
for i in range(N):
x = filter(None, x)
tuple(x)
except RuntimeError:
print("RuntimeError")
try:
x = (1, 2)
for i in range(N):
x = map(max, x, ())
tuple(x)
except RuntimeError:
print("RuntimeError")
try:
x = (1, 2)
for i in range(N):
x = zip(x)
tuple(x)
except RuntimeError:
print("RuntimeError")
|