aboutsummaryrefslogtreecommitdiff
path: root/extmod/uasyncio/core.py
diff options
context:
space:
mode:
Diffstat (limited to 'extmod/uasyncio/core.py')
-rw-r--r--extmod/uasyncio/core.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/extmod/uasyncio/core.py b/extmod/uasyncio/core.py
index 045b4cd13..6a84b0982 100644
--- a/extmod/uasyncio/core.py
+++ b/extmod/uasyncio/core.py
@@ -185,8 +185,6 @@ def run_until_complete(main_task=None):
if isinstance(er, StopIteration):
return er.value
raise er
- # Save return value of coro to pass up to caller
- t.data = er
# Schedule any other tasks waiting on the completion of this task
waiting = False
if hasattr(t, "waiting"):
@@ -194,13 +192,15 @@ def run_until_complete(main_task=None):
_task_queue.push_head(t.waiting.pop_head())
waiting = True
t.waiting = None # Free waiting queue head
- # Print out exception for detached tasks
if not waiting and not isinstance(er, excs_stop):
- _exc_context["exception"] = er
- _exc_context["future"] = t
- Loop.call_exception_handler(_exc_context)
- # Indicate task is done
- t.coro = None
+ # An exception ended this detached task, so queue it for later
+ # execution to handle the uncaught exception if no other task retrieves
+ # the exception in the meantime (this is handled by Task.throw).
+ _task_queue.push_head(t)
+ # Indicate task is done by setting coro to the task object itself
+ t.coro = t
+ # Save return value of coro to pass up to caller
+ t.data = er
# Create a new task from a coroutine and run it until it finishes