Move `trio` scope outside first inter-task-chan receive

debug_lock_blocking
Tyler Goodlet 2022-10-11 14:03:49 -04:00
parent 30ea7a06b0
commit 734d8dd663
1 changed files with 10 additions and 8 deletions

View File

@ -466,11 +466,11 @@ async def open_channel_from(
): ):
# sync to a "started()"-like first delivered value from the # sync to a "started()"-like first delivered value from the
# ``asyncio`` task. # ``asyncio`` task.
first = await chan.receive()
# deliver stream handle upward
try: try:
with chan._trio_cs: with chan._trio_cs:
first = await chan.receive()
# deliver stream handle upward
yield first, chan yield first, chan
finally: finally:
chan._trio_exited = True chan._trio_exited = True
@ -491,16 +491,18 @@ def run_as_asyncio_guest(
SC semantics. SC semantics.
''' '''
# Uh, oh. :o # Uh, oh.
#
# :o
# It looks like your event loop has caught a case of the ``trio``s. # 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 # Don't worry, we've heard you'll barely notice. You might
# a few more propagating errors and feel like your digestion has # hallucinate a few more propagating errors and feel like your
# slowed but if anything get's too bad your parents will know about # digestion has slowed but if anything get's too bad your parents
# it. # will know about it.
# :) # :)