From 7a651652796d78a98e354c34bb56599ff07bf15e Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 14 Oct 2021 17:30:18 -0400 Subject: [PATCH] Facepalm, re-raise captured `asyncio` task error --- tractor/to_asyncio.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tractor/to_asyncio.py b/tractor/to_asyncio.py index 936ab3f..d27edc9 100644 --- a/tractor/to_asyncio.py +++ b/tractor/to_asyncio.py @@ -102,6 +102,7 @@ def _run_asyncio_task( except BaseException as err: aio_err = err from_aio._err = aio_err + raise finally: aio_task_complete.set() if result != orig and aio_err is None: @@ -119,9 +120,11 @@ def _run_asyncio_task( else: raise TypeError(f"No support for invoking {coro}") - def cancel_trio(task): - """Cancel the calling ``trio`` task on error. - """ + def cancel_trio(task) -> None: + ''' + Cancel the calling ``trio`` task on error. + + ''' nonlocal aio_err try: aio_err = task.exception()