tests/extmod/uasyncio_heaplock.py: Force SKIP on stackless.

This is a latent issue that wasn't caught by CI because there was no
configuration that had both stackless+uasyncio.

The previous check to skip with stackless builds only worked when the
bytecode emitter was used by default.  Force the check to use the bytecode
emitter.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
Jim Mussared 2022-09-13 16:40:34 +10:00 committed by Damien George
parent 51b054dd66
commit 6c376a9306

View File

@ -8,11 +8,19 @@ import micropython
# strict stackless builds can't call functions without allocating a frame on the heap
try:
f = lambda: 0
# force bytecode (in case we're running with emit=native) and verify
# that bytecode-calling-bytecode doesn't allocate
@micropython.bytecode
def f(x):
x and f(x - 1)
micropython.heap_lock()
f()
f(1)
micropython.heap_unlock()
except RuntimeError:
# RuntimeError (max recursion depth) not MemoryError because effectively
# the recursion depth is at the limit while the heap is locked with
# stackless
print("SKIP")
raise SystemExit