Skip to content

Commit b78fac1

Browse files
committed
tests/ports/esp32/check_err_str.py: Preallocate global variable.
This test fails on all esp32 boards without this fix, because the try/except that runs with the heap locked attempts to increase the size of the globals dict when assigning to the exception variable `e`. Fix that by preallocating the global variable `e`. Signed-off-by: Damien George <[email protected]>
1 parent 5305285 commit b78fac1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/ports/esp32/check_err_str.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# This tests checks the behaviour of the `check_esp_err`/`check_esp_err_` C function.
2+
13
try:
24
from esp32 import Partition as p
35
import micropython
@@ -23,6 +25,7 @@
2325

2426
# same but with out of memory condition by locking the heap
2527
exc = "FAILED TO RAISE"
28+
e = None # preallocate entry in globals dict
2629
micropython.heap_lock()
2730
try:
2831
fun(part)
@@ -34,6 +37,7 @@
3437
# same again but having an emergency buffer
3538
micropython.alloc_emergency_exception_buf(256)
3639
exc = "FAILED TO RAISE"
40+
e = None # preallocate entry in globals dict
3741
micropython.heap_lock()
3842
try:
3943
fun(part)

0 commit comments

Comments
 (0)