| 1 |
From: Carl Smedstad <[email protected]> |
| 2 |
Date: Tue, 4 Mar 2025 12:52:26 +0100 |
| 3 |
Subject: Don't depend on async-timeout for Python 3.11+ |
| 4 |
|
| 5 |
This library has effectively been upstreamed into Python 3.11+ and is no longer |
| 6 |
actively supported. |
| 7 |
|
| 8 |
See: https://archlinux.org/todo/deprecate-python-async-timeout/ |
| 9 |
|
| 10 |
Forwarded: https://github.com/aio-libs/aiopg/pull/914 |
| 11 |
--- |
| 12 |
aiopg/pool.py | 6 +++++- |
| 13 |
setup.py | 2 +- |
| 14 |
2 files changed, 6 insertions(+), 2 deletions(-) |
| 15 |
|
| 16 |
diff --git a/aiopg/pool.py b/aiopg/pool.py |
| 17 |
index 4d6015c..6865e7c 100644 |
| 18 |
--- a/aiopg/pool.py |
| 19 |
+++ b/aiopg/pool.py |
| 20 |
@@ -1,5 +1,6 @@ |
| 21 |
import asyncio |
| 22 |
import collections |
| 23 |
+import sys |
| 24 |
import warnings |
| 25 |
from types import TracebackType |
| 26 |
from typing import ( |
| 27 |
@@ -13,7 +14,10 @@ from typing import ( |
| 28 |
Type, |
| 29 |
) |
| 30 |
|
| 31 |
-import async_timeout |
| 32 |
+if sys.version_info >= (3, 11): |
| 33 |
+ import asyncio as async_timeout |
| 34 |
+else: |
| 35 |
+ import async_timeout |
| 36 |
import psycopg2.extensions |
| 37 |
|
| 38 |
from .connection import TIMEOUT, Connection, Cursor, connect |
| 39 |
diff --git a/setup.py b/setup.py |
| 40 |
index 9fb659c..6c530d4 100644 |
| 41 |
--- a/setup.py |
| 42 |
+++ b/setup.py |
| 43 |
@@ -3,7 +3,7 @@ from pathlib import Path |
| 44 |
|
| 45 |
from setuptools import setup, find_packages |
| 46 |
|
| 47 |
-install_requires = ["psycopg2-binary>=2.9.5", "async_timeout>=3.0,<5.0"] |
| 48 |
+install_requires = ["psycopg2-binary>=2.9.5", "async_timeout>=3.0,<5.0; python_version < '3.11'"] |
| 49 |
extras_require = {"sa": ["sqlalchemy[postgresql_psycopg2binary]>=1.4,<2.1"]} |
| 50 |
|
| 51 |
|