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
# ``asyncio`` task.
try:
with chan._trio_cs:
first = await chan.receive()
# deliver stream handle upward
try:
with chan._trio_cs:
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.
# :)