Skip to content

Commit a1d85d6

Browse files
committed
tests/basics/memoryerror: Add test for out-of-memory using realloc.
1 parent 26d4a6f commit a1d85d6

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

tests/basics/memoryerror.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1+
# test out-of-memory with malloc
12
l = list(range(1000))
23
try:
34
1000000000 * l
45
except MemoryError:
56
print('MemoryError')
67
print(len(l), l[0], l[-1])
8+
9+
# test out-of-memory with realloc
10+
try:
11+
[].extend(range(1000000000))
12+
except MemoryError:
13+
print('MemoryError')

tests/basics/memoryerror.py.exp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
MemoryError
22
1000 0 999
3+
MemoryError

0 commit comments

Comments
 (0)