From 5eabfb01f0f7998f5d26ab68b3adce30b189f1d4 Mon Sep 17 00:00:00 2001 From: Piotr Marcinkiewicz Date: Thu, 14 Nov 2024 11:01:54 +0100 Subject: [PATCH] Don't use shutdown_default_executor for Python 3.8 --- pytriton/proxy/inference.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pytriton/proxy/inference.py b/pytriton/proxy/inference.py index dccb2c6..03fd847 100644 --- a/pytriton/proxy/inference.py +++ b/pytriton/proxy/inference.py @@ -333,7 +333,9 @@ def run(self): try: _cancel_all_tasks(self._loop) self._loop.run_until_complete(self._loop.shutdown_asyncgens()) - self._loop.run_until_complete(self._loop.shutdown_default_executor()) + # shutdown default executor was introduced in Python 3.9 + if hasattr(self._loop, "shutdown_default_executor"): + self._loop.run_until_complete(self._loop.shutdown_default_executor()) finally: asyncio.set_event_loop(None) self._loop.close()