Skip to content

Commit 3b945dd

Browse files
committed
cancel_and_wait: Re-raise if it was our task
Reraise the cancel error if it was our task that was cancelled. Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 9bb153d commit 3b945dd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/frequenz/sdk/_internal/_asyncio.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ async def cancel_and_await(task: asyncio.Task[Any]) -> None:
2929
try:
3030
await task
3131
except asyncio.CancelledError:
32-
pass
32+
if not task.cancelled():
33+
raise
3334

3435

3536
async def run_forever(

0 commit comments

Comments
 (0)