Skip to content

Commit 9370711

Browse files
authored
clean warnings (#2731)
1 parent cfdcfd8 commit 9370711

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

redis/asyncio/client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ async def __aexit__(self, exc_type, exc_value, traceback):
455455
_DEL_MESSAGE = "Unclosed Redis client"
456456

457457
def __del__(self, _warnings: Any = warnings) -> None:
458-
if self.connection is not None:
458+
if hasattr(self, "connection") and (self.connection is not None):
459459
_warnings.warn(
460460
f"Unclosed client session {self!r}", ResourceWarning, source=self
461461
)

0 commit comments

Comments
 (0)