summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2025-12-10 12:39:01 +1100
committerDamien George <damien@micropython.org>2025-12-16 23:37:59 +1100
commitb78fac161e34eb953c499eb17630e67355a9508a (patch)
tree80f1e862ed1d46c257aebedfde362d2e538dcf4c
parent53052857e2e5845cbf78f778d40ccd59f4f2e3ef (diff)
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 <damien@micropython.org>
-rw-r--r--tests/ports/esp32/check_err_str.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/ports/esp32/check_err_str.py b/tests/ports/esp32/check_err_str.py
index 055eecf74..9efe1afa1 100644
--- a/tests/ports/esp32/check_err_str.py
+++ b/tests/ports/esp32/check_err_str.py
@@ -1,3 +1,5 @@
+# This tests checks the behaviour of the `check_esp_err`/`check_esp_err_` C function.
+
try:
from esp32 import Partition as p
import micropython
@@ -23,6 +25,7 @@ except OSError as e:
# same but with out of memory condition by locking the heap
exc = "FAILED TO RAISE"
+e = None # preallocate entry in globals dict
micropython.heap_lock()
try:
fun(part)
@@ -34,6 +37,7 @@ print("exc:", exc) # exc empty due to no memory
# same again but having an emergency buffer
micropython.alloc_emergency_exception_buf(256)
exc = "FAILED TO RAISE"
+e = None # preallocate entry in globals dict
micropython.heap_lock()
try:
fun(part)