From 70fadbf97c5a117ca13f6c8f4f111ba5025f3c94 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Thu, 13 May 2021 22:41:46 +0200 Subject: [PATCH] Restore compatibility with Python < 3.9. Fix #951. --- docs/changelog.rst | 7 +++++++ src/websockets/__main__.py | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 1e5f92211..fb40aee2a 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -30,6 +30,13 @@ They may change at any time. *In development* +9.0.2 +..... + +*In development* + +* Restored compatibility of ``python -m websockets`` with Python < 3.9. + 9.0.1 ..... diff --git a/src/websockets/__main__.py b/src/websockets/__main__.py index d44e34e74..fb126997a 100644 --- a/src/websockets/__main__.py +++ b/src/websockets/__main__.py @@ -178,11 +178,11 @@ def main() -> None: # Due to zealous removal of the loop parameter in the Queue constructor, # we need a factory coroutine to run in the freshly created event loop. - async def queue_factory() -> asyncio.Queue[str]: + async def queue_factory() -> "asyncio.Queue[str]": return asyncio.Queue() # Create a queue of user inputs. There's no need to limit its size. - inputs: asyncio.Queue[str] = loop.run_until_complete(queue_factory()) + inputs: "asyncio.Queue[str]" = loop.run_until_complete(queue_factory()) # Create a stop condition when receiving SIGINT or SIGTERM. stop: asyncio.Future[None] = loop.create_future()