summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--redis/asyncio/client.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/redis/asyncio/client.py b/redis/asyncio/client.py
index 3e6626a..5fb94b3 100644
--- a/redis/asyncio/client.py
+++ b/redis/asyncio/client.py
@@ -455,7 +455,7 @@ class Redis(
_DEL_MESSAGE = "Unclosed Redis client"
def __del__(self, _warnings: Any = warnings) -> None:
- if self.connection is not None:
+ if hasattr(self, "connection") and (self.connection is not None):
_warnings.warn(
f"Unclosed client session {self!r}", ResourceWarning, source=self
)