From a2ab55a5ff3fb526f8a8c25ac5734f0dc44654f0 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Thu, 9 Jan 2025 09:39:38 +0000 Subject: [PATCH] shutdown_asyncgens is 3.9 only --- src/prompt_toolkit/application/_compat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/prompt_toolkit/application/_compat.py b/src/prompt_toolkit/application/_compat.py index ec43d4406..f689713d3 100644 --- a/src/prompt_toolkit/application/_compat.py +++ b/src/prompt_toolkit/application/_compat.py @@ -66,7 +66,8 @@ def asyncio_run( try: _cancel_all_tasks(loop) loop.run_until_complete(loop.shutdown_asyncgens()) - loop.run_until_complete(loop.shutdown_default_executor()) + if sys.version_info >= (3, 9): + loop.run_until_complete(loop.shutdown_default_executor()) finally: if loop_factory is None: asyncio.set_event_loop(None)