From 173098b21ba59df6a3b858f3b1482c31c79f40ed Mon Sep 17 00:00:00 2001 From: sobolevn Date: Tue, 15 Oct 2024 11:59:04 +0300 Subject: [PATCH] docs: make sure that `channels` use `finally` in all examples (#3796) --- docs/usage/channels.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/usage/channels.rst b/docs/usage/channels.rst index 5d9fd8daf4..e139adb60a 100644 --- a/docs/usage/channels.rst +++ b/docs/usage/channels.rst @@ -219,8 +219,10 @@ subscriptions need to be managed dynamically. .. code-block:: python subscriber = await channels.subscribe(["foo", "bar"]) - ... # do some stuff here - await channels.unsubscribe(subscriber, ["foo"]) + try: + ... # do some stuff here + finally: + await channels.unsubscribe(subscriber, ["foo"]) Or, using the context manager