Set cancelled state in cancel method

asyncgen_closing_fix
Tyler Goodlet 2018-07-11 19:24:08 -04:00
parent 1ade5c5fbb
commit d9aa6119e1
2 changed files with 2 additions and 2 deletions

View File

@ -247,7 +247,6 @@ async def test_trynamic_trio():
'gretchen',
main=partial(say_hello, 'donny'),
rpc_module_paths=[__name__],
# outlive_main=True
)
print(await gretchen.result())
print(await donny.result())
@ -361,6 +360,7 @@ async def aggregate(seed):
async for value in await portal.run(
__name__, 'stream_data', seed=seed
):
# leverage trio's built-in backpressure
await q.put(value)
await q.put(None)

View File

@ -867,6 +867,7 @@ class ActorNursery:
log.debug(f"Waiting on all subactors to complete")
await self.wait()
self.cancelled = True
log.debug(f"All subactors for {self} have terminated")
async def __aexit__(self, etype, value, tb):
@ -891,7 +892,6 @@ class ActorNursery:
except Exception as err:
log.warn(f"Nursery caught {err}, cancelling")
await self.cancel()
self.cancelled = True
raise
log.debug(f"Nursery teardown complete")