Skip to content

Commit 4caadc3

Browse files
committed
tests/micropython/extreme_exc.py: Fix test to run on more ports/configs.
1 parent f1df86a commit 4caadc3

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

tests/micropython/extreme_exc.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
import micropython
44

5+
# Check for stackless build, which can't call functions without
6+
# allocating a frame on the heap.
7+
try:
8+
def stackless(): pass
9+
micropython.heap_lock(); stackless(); micropython.heap_unlock()
10+
except RuntimeError:
11+
print("SKIP")
12+
raise SystemExit
13+
514
# some ports need to allocate heap for the emergency exception
615
try:
716
micropython.alloc_emergency_exception_buf(256)
@@ -40,8 +49,9 @@ def f():
4049
f(abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=1)
4150
except Exception as er:
4251
e = er
52+
lst[0] = None
4353
lst = None
44-
print(repr(e))
54+
print(repr(e)[:43])
4555

4656
# raise a deep exception with the heap locked
4757
# should use emergency exception and be unable to resize traceback array
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Exception()
22
TypeError("unexpected keyword argument 'abcdefghij
3-
TypeError("unexpected keyword argument 'abc",)
3+
TypeError("unexpected keyword argument 'abc
44
RuntimeError('maximum recursion depth exceeded',)
55
Exception('my exception',)

0 commit comments

Comments
 (0)