Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: workaround broken asyncio.staggered on python < 3.8.2 #61

Merged
merged 5 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,19 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.8.0"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
os:
- ubuntu-latest
- ubuntu-20.04
- windows-latest
- macOS-latest
exclude:
- os: macOS-latest
python-version: "3.8.0"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down
12 changes: 12 additions & 0 deletions src/aiohappyeyeballs/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,23 @@
import functools
import itertools
import socket
import sys
from asyncio import staggered
from typing import List, Optional, Sequence

from .types import AddrInfoType

if sys.version_info < (3, 8, 2): # noqa: UP036
# asyncio.staggered is broken in Python 3.8.0 and 3.8.1
# so it must be patched:
# https://github.com/aio-libs/aiohttp/issues/8556
# https://bugs.python.org/issue39129
# https://github.com/python/cpython/pull/17693
import asyncio
bdraco marked this conversation as resolved.
Show resolved Hide resolved
import asyncio.futures

asyncio.futures.TimeoutError = asyncio.TimeoutError # type: ignore[attr-defined]


async def start_connection(
addr_infos: Sequence[AddrInfoType],
Expand Down
Loading