Commit 6fc6f10b authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

tests/ Heap alloc test for raising/catching exc.

parent 3d739eb3
# Test that we can raise and catch (preallocated) exception
# without memory allocation.
import micropython
e = ValueError("error")
def func():
# This works as is because traceback is not allocated
# if not possible (heap is locked, no memory). If heap
# is not locked, this would allocate a traceback entry.
# To avoid that, traceback should be warmed up (by raising
# it once after creation) and then cleared before each
# raise with:
# e.__traceback__ = None
raise e
except Exception as e2:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment