From 17e7fa6e90517699ea9f1c170b82aff43b7b2b69 Mon Sep 17 00:00:00 2001 From: Romain Geissler Date: Tue, 18 Mar 2025 01:24:33 +0000 Subject: [PATCH] Don't depend on async-timeout for Python 3.11+. This library was upstreamed into the standard library and is thus deprecated. --- hole/v5.py | 7 ++++++- hole/v6.py | 7 ++++++- setup.py | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/hole/v5.py b/hole/v5.py index 1c3e3a1..bfac2de 100644 --- a/hole/v5.py +++ b/hole/v5.py @@ -5,7 +5,12 @@ import socket import aiohttp -import async_timeout +import sys + +if sys.version_info >= (3, 11): + import asyncio as async_timeout +else: + import async_timeout from . import exceptions diff --git a/hole/v6.py b/hole/v6.py index 71b7c98..eacc4a1 100644 --- a/hole/v6.py +++ b/hole/v6.py @@ -8,7 +8,12 @@ from typing import Optional, Literal import aiohttp -import async_timeout +import sys + +if sys.version_info >= (3, 11): + import asyncio as async_timeout +else: + import async_timeout from . import exceptions diff --git a/setup.py b/setup.py index c471cb8..9112795 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ license="MIT", install_requires=[ "aiohttp<4", - "async_timeout>4,<5", + 'async_timeout; python_version < "3.11"', ], packages=["hole"], python_requires=">=3.9",