diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-12-11 11:56:20 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-12-11 12:00:41 +0200 |
commit | e02cb9ec318580497dbb17f369a61d9e932094e5 (patch) | |
tree | 3a280551b559fb153f3d28ac978442b4ef20e655 /tests/micropython/heapalloc_exc_raise.py | |
parent | 30fd8484ebe41faad467fbc8dd4a6f72250f203c (diff) |
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.
Diffstat (limited to 'tests/micropython/heapalloc_exc_raise.py')
-rw-r--r-- | tests/micropython/heapalloc_exc_raise.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/micropython/heapalloc_exc_raise.py b/tests/micropython/heapalloc_exc_raise.py index d60e14ce5..fb63a84bf 100644 --- a/tests/micropython/heapalloc_exc_raise.py +++ b/tests/micropython/heapalloc_exc_raise.py @@ -5,6 +5,7 @@ import micropython e = ValueError("error") def func(): + micropython.heap_lock() try: # This works as is because traceback is not allocated # if not possible (heap is locked, no memory). If heap @@ -16,8 +17,7 @@ def func(): raise e except Exception as e2: print(e2) + micropython.heap_unlock() -micropython.heap_lock() func() print("ok") -micropython.heap_unlock() |