Closed
Description
Port, board and/or hardware
Unix build (also verified on RP2 2)
MicroPython version
MicroPython v1.24.1 on 2024-11-29; Raspberry Pi Pico2 with RP2350
Reproduction
Paste the following at the REPL
import asyncio
evt = asyncio.Event()
async def foo():
data = [1,2,3]
for d in data:
print(d)
await asyncio.sleep(1)
await evt.wait() # Should hang
async def main():
await foo()
asyncio.run(main())
Expected behaviour
Should print 1, 2, 3 then hang. This happens under CPython 3.10.12
1
2
3
Observed behaviour
Under MP, after expected output, it returns to the REPL.
1
2
3
>>>
Additional Information
This may be related to #16318
I am encountering the phenomenon of premature return in a number of situations, notably in test scripts where there are no pending tasks. I have never observed it in applications where there are multiple concurrent tasks.
Code of Conduct
Yes, I agree