extmod/asyncio: Make current_task raise exception when there is no task.
Matches CPython behaviour. Fixes issue #11530. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -19,4 +19,15 @@ async def main():
|
||||
print(t is result[0])
|
||||
|
||||
|
||||
try:
|
||||
print(asyncio.current_task())
|
||||
except RuntimeError:
|
||||
print("RuntimeError")
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
|
||||
try:
|
||||
print(asyncio.current_task())
|
||||
except RuntimeError:
|
||||
print("RuntimeError")
|
||||
|
||||
Reference in New Issue
Block a user