From 734d8dd6633a2f370720ed25e5043728d3384ed5 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 11 Oct 2022 14:03:49 -0400 Subject: [PATCH] Move `trio` scope outside first inter-task-chan receive --- tractor/to_asyncio.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tractor/to_asyncio.py b/tractor/to_asyncio.py index aeb376a..be3ac8d 100644 --- a/tractor/to_asyncio.py +++ b/tractor/to_asyncio.py @@ -466,11 +466,11 @@ async def open_channel_from( ): # sync to a "started()"-like first delivered value from the # ``asyncio`` task. - first = await chan.receive() - - # deliver stream handle upward try: with chan._trio_cs: + first = await chan.receive() + + # deliver stream handle upward yield first, chan finally: chan._trio_exited = True @@ -491,16 +491,18 @@ def run_as_asyncio_guest( SC semantics. ''' - # Uh, oh. :o + # Uh, oh. + # + # :o # It looks like your event loop has caught a case of the ``trio``s. # :() - # Don't worry, we've heard you'll barely notice. You might hallucinate - # a few more propagating errors and feel like your digestion has - # slowed but if anything get's too bad your parents will know about - # it. + # Don't worry, we've heard you'll barely notice. You might + # hallucinate a few more propagating errors and feel like your + # digestion has slowed but if anything get's too bad your parents + # will know about it. # :)