summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/memoryerror.py
blob: 18053f097aa5a0c8d417f4ea2b5bb39c0970493e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
# test out-of-memory with malloc
l = list(range(1000))
try:
    1000000000 * l
except MemoryError:
    print('MemoryError')
print(len(l), l[0], l[-1])

# test out-of-memory with realloc
try:
    [].extend(range(1000000000))
except MemoryError:
    print('MemoryError')