summaryrefslogtreecommitdiff
path: root/extmod/asyncio/core.py
diff options
context:
space:
mode:
Diffstat (limited to 'extmod/asyncio/core.py')
-rw-r--r--extmod/asyncio/core.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/extmod/asyncio/core.py b/extmod/asyncio/core.py
index 214cc52f4..e5af3038f 100644
--- a/extmod/asyncio/core.py
+++ b/extmod/asyncio/core.py
@@ -219,6 +219,11 @@ def run_until_complete(main_task=None):
elif t.state is None:
# Task is already finished and nothing await'ed on the task,
# so call the exception handler.
+
+ # Save exception raised by the coro for later use.
+ t.data = exc
+
+ # Create exception context and call the exception handler.
_exc_context["exception"] = exc
_exc_context["future"] = t
Loop.call_exception_handler(_exc_context)