summaryrefslogtreecommitdiff
path: root/redis/client.py
diff options
context:
space:
mode:
Diffstat (limited to 'redis/client.py')
-rwxr-xr-xredis/client.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/redis/client.py b/redis/client.py
index de0180c..c51ab91 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -1151,6 +1151,12 @@ class Redis(AbstractRedis, RedisModuleCommands, CoreCommands, SentinelCommands):
self.close()
def close(self):
+ # 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
+
conn = self.connection
if conn:
self.connection = None