blob: 48ce9dd69e6e2d47eb26be65fe86d63b778677ff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
import micropython
# Does the full test from heapalloc_exc_compressed.py but while the heap is
# locked (this can only work when the emergency exception buf is enabled).
# Some ports need to allocate heap for the emgergency exception buffer.
try:
micropython.alloc_emergency_exception_buf(256)
except AttributeError:
pass
def test():
micropython.heap_lock()
try:
name()
except NameError as e:
print(type(e).__name__, e)
try:
raise 0
except TypeError as e:
print(type(e).__name__, e)
try:
name()
except NameError as e:
print(e.args[0])
try:
raise 0
except TypeError as e:
print(e.args[0])
micropython.heap_unlock()
test()
|