Skip to content

Commit

Permalink
clean warnings (#2731)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvora-h authored May 8, 2023
1 parent cfdcfd8 commit 9370711
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion redis/asyncio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ async def __aexit__(self, exc_type, exc_value, traceback):
_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
)
Expand Down

0 comments on commit 9370711

Please sign in to comment.