From e02cb9ec318580497dbb17f369a61d9e932094e5 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Mon, 11 Dec 2017 11:56:20 +0200 Subject: tests/heapalloc_*: Refactor some tests to work in strict stackless mode. In strict stackless mode, it's not possible to make a function call with heap locked (because function activation record aka frame is allocated on heap). So, if the only purpose of function is to introduce local variable scope, move heap lock/unlock calls inside the function. --- tests/micropython/heapalloc_traceback.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/micropython/heapalloc_traceback.py') diff --git a/tests/micropython/heapalloc_traceback.py b/tests/micropython/heapalloc_traceback.py index f4212b6ce..813dea4b2 100644 --- a/tests/micropython/heapalloc_traceback.py +++ b/tests/micropython/heapalloc_traceback.py @@ -16,17 +16,17 @@ except: pass def test(): + micropython.heap_lock() global global_exc global_exc.__traceback__ = None try: raise global_exc except StopIteration: print('StopIteration') + micropython.heap_unlock() # call test() with heap allocation disabled -micropython.heap_lock() test() -micropython.heap_unlock() # print the exception that was raised buf = uio.StringIO() -- cgit v1.2.3