diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f96568..5a89ac2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: needs: lint strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"] os: [ubuntu] fail-fast: false diff --git a/janus/__init__.py b/janus/__init__.py index 789f12f..c29c23e 100644 --- a/janus/__init__.py +++ b/janus/__init__.py @@ -1,4 +1,5 @@ import asyncio +import sys import threading from asyncio import QueueEmpty as AsyncQueueEmpty from asyncio import QueueFull as AsyncQueueFull @@ -36,6 +37,9 @@ def __init__(self, maxsize: int = 0) -> None: self._all_tasks_done = threading.Condition(self._sync_mutex) self._async_mutex = asyncio.Lock() + if sys.version_info[:3] == (3, 10, 0): + # Workaround for Python 3.10 bug, see #358: + getattr(self._async_mutex, '_get_loop', lambda: None)() self._async_not_empty = asyncio.Condition(self._async_mutex) self._async_not_full = asyncio.Condition(self._async_mutex) self._finished = asyncio.Event()