From 1b951502dc8f149fa66beafeea40c782f1c5c1d3 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Mon, 6 Feb 2023 08:56:28 +0900 Subject: [PATCH] Fix Python 3.11 error --- CHANGES/1490.bugfix | 1 + CONTRIBUTORS.txt | 1 + aioredis/exceptions.py | 9 ++++++--- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 CHANGES/1490.bugfix diff --git a/CHANGES/1490.bugfix b/CHANGES/1490.bugfix new file mode 100644 index 000000000..8c222a2f4 --- /dev/null +++ b/CHANGES/1490.bugfix @@ -0,0 +1 @@ +aioredis.TimeoutError inherits only builtins.TimeoutError when Python asyncio.TimeoutError == builtins.TimeoutError. diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 36953225a..37bbe5ed6 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -37,6 +37,7 @@ Ivan Antonyuck James Hilliard Jan Špaček Jeff Moser +Jeong, YunWon Joongi Kim Kyrylo Dehtyarenko Leonid Shvechikov diff --git a/aioredis/exceptions.py b/aioredis/exceptions.py index e4c2ed1e4..9cf3a3a3d 100644 --- a/aioredis/exceptions.py +++ b/aioredis/exceptions.py @@ -10,9 +10,12 @@ class RedisError(Exception): class ConnectionError(RedisError): pass - -class TimeoutError(asyncio.TimeoutError, builtins.TimeoutError, RedisError): - pass +if asyncio.TimeoutError is builtins.TimeoutError: # >= Python 3.11 + class TimeoutError(builtins.TimeoutError, RedisError): + pass +else: + class TimeoutError(asyncio.TimeoutError, builtins.TimeoutError, RedisError): + pass class AuthenticationError(ConnectionError):