From a1d85d6199c03871ccf16700743160fad64d057b Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 20 Dec 2017 16:58:27 +1100 Subject: [PATCH] tests/basics/memoryerror: Add test for out-of-memory using realloc. --- tests/basics/memoryerror.py | 7 +++++++ tests/basics/memoryerror.py.exp | 1 + 2 files changed, 8 insertions(+) diff --git a/tests/basics/memoryerror.py b/tests/basics/memoryerror.py index ba145b7d4e..18053f097a 100644 --- a/tests/basics/memoryerror.py +++ b/tests/basics/memoryerror.py @@ -1,6 +1,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') diff --git a/tests/basics/memoryerror.py.exp b/tests/basics/memoryerror.py.exp index c41e8c1a6a..3d6c7f0009 100644 --- a/tests/basics/memoryerror.py.exp +++ b/tests/basics/memoryerror.py.exp @@ -1,2 +1,3 @@ MemoryError 1000 0 999 +MemoryError