From 876943401ec2153071dea1a1c1148889cdb7cd60 Mon Sep 17 00:00:00 2001 From: James Hilliard Date: Thu, 21 Mar 2024 12:06:00 -0600 Subject: [PATCH] Raise exception if exec_coro is done. --- asgiref/sync.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/asgiref/sync.py b/asgiref/sync.py index f263a432..4427fc2a 100644 --- a/asgiref/sync.py +++ b/asgiref/sync.py @@ -478,6 +478,8 @@ async def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _R: pass except IndexError: pass + if exec_coro.done(): + raise if cancel_parent: exec_coro.cancel() ret = await exec_coro