diff options
author | shacharPash <93581407+shacharPash@users.noreply.github.com> | 2023-03-28 16:10:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-28 16:10:25 +0300 |
commit | 6d886d7c7b405c0fe5d59ca192c87b438bf080f5 (patch) | |
tree | 7a824cfc8928cc9ab8def9da31b4a6c3d7019551 /redis/asyncio/client.py | |
parent | 326bb1cf156279919101cc88a696d6cfcd9f3fe9 (diff) | |
download | redis-py-6d886d7c7b405c0fe5d59ca192c87b438bf080f5.tar.gz |
Fix issue 2660: PytestUnraisableExceptionWarning from asycio client (#2669)
Diffstat (limited to 'redis/asyncio/client.py')
-rw-r--r-- | redis/asyncio/client.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/redis/asyncio/client.py b/redis/asyncio/client.py index 9e16ee0..5de2ff9 100644 --- a/redis/asyncio/client.py +++ b/redis/asyncio/client.py @@ -702,6 +702,11 @@ class PubSub: self.pending_unsubscribe_patterns = set() def close(self) -> Awaitable[NoReturn]: + # In case a connection property does not yet exist + # (due to a crash earlier in the Redis() constructor), return + # immediately as there is nothing to clean-up. + if not hasattr(self, "connection"): + return return self.reset() async def on_connect(self, connection: Connection): |