Only close recv chan if we get a ref

round_2_ci_windows
Tyler Goodlet 2021-06-10 13:58:06 -04:00
parent 5b8b7d374a
commit 39b9896a62
1 changed files with 3 additions and 1 deletions

View File

@ -359,6 +359,7 @@ class Portal:
fn_mod_path, fn_name = func_deats(func) fn_mod_path, fn_name = func_deats(func)
recv_chan: trio.ReceiveMemoryChannel = None
try: try:
cid, recv_chan, functype, first_msg = await self._submit( cid, recv_chan, functype, first_msg = await self._submit(
fn_mod_path, fn_name, kwargs) fn_mod_path, fn_name, kwargs)
@ -390,7 +391,8 @@ class Portal:
await ctx.cancel() await ctx.cancel()
finally: finally:
await recv_chan.aclose() if recv_chan is not None:
await recv_chan.aclose()
@dataclass @dataclass
class LocalPortal: class LocalPortal: