From d77d139975c2d93c2b26336427dd3e7fae675d59 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Sat, 3 Jul 2021 23:51:16 +0100 Subject: [PATCH] make BlockingPortal.stop sync --- src/anyio/from_thread.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/anyio/from_thread.py b/src/anyio/from_thread.py index 26d4a2623..550817d2e 100644 --- a/src/anyio/from_thread.py +++ b/src/anyio/from_thread.py @@ -143,7 +143,7 @@ async def sleep_until_stopped(self) -> None: """Sleep until :meth:`stop` is called.""" await self._stop_event.wait() - async def stop(self, cancel_remaining: bool = False) -> None: + def stop(self, cancel_remaining: bool = False) -> DeprecatedAwaitable: """ Signal the portal to shut down. @@ -159,6 +159,8 @@ async def stop(self, cancel_remaining: bool = False) -> None: if cancel_remaining: self._task_group.cancel_scope.cancel() + return DeprecatedAwaitable(self.stop) + async def _call_func(self, func: Callable, args: tuple, kwargs: Dict[str, Any], future: Future) -> None: def callback(f: Future) -> None: