From a044e3dd7970560a5e62bb26330ea9882cfb92d9 Mon Sep 17 00:00:00 2001 From: Soxoj Date: Wed, 24 Mar 2021 21:37:31 +0300 Subject: [PATCH] Fix of 3.6.9 asyncio create_task error --- .github/workflows/python-package.yml | 2 +- maigret/checking.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index a4dba35..852b1d1 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: [3.6.9, 3.7, 3.8, 3.9] steps: - uses: actions/checkout@v2 diff --git a/maigret/checking.py b/maigret/checking.py index a4cb18d..bc3434f 100644 --- a/maigret/checking.py +++ b/maigret/checking.py @@ -119,7 +119,14 @@ class AsyncioProgressbarQueueExecutor(AsyncExecutor): async def _run(self, tasks: QueriesDraft): self.results = [] - workers = [asyncio.create_task(self.worker()) + + if sys.version_info.minor > 6: + create_task = asyncio.create_task + else: + loop = asyncio.get_event_loop() + create_task = loop.create_task + + workers = [create_task(self.worker()) for _ in range(self.workers_count)] task_list = list(tasks) self.progress = self.progress_func(total=len(task_list))