From 0c27fd2311d512629825eba39868ffc107d2971d Mon Sep 17 00:00:00 2001 From: Clay Gerrard Date: Wed, 17 Jan 2018 13:56:13 -0800 Subject: [PATCH] Reset state every iteration to avoid stale reference If you get a valid but unexpected response status you have to continue the loop. If you don't reset resp = None some kinds of exceptions might get re-raised as with the wrong error. Change-Id: I5751dfbc176155bea63103a64fd8d4db62323e60 --- swift/common/internal_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swift/common/internal_client.py b/swift/common/internal_client.py index bba5d209db..6f42c0b296 100644 --- a/swift/common/internal_client.py +++ b/swift/common/internal_client.py @@ -179,8 +179,8 @@ class InternalClient(object): headers = dict(headers) headers['user-agent'] = self.user_agent - resp = exc_type = exc_value = exc_traceback = None for attempt in range(self.request_tries): + resp = exc_type = exc_value = exc_traceback = None req = Request.blank( path, environ={'REQUEST_METHOD': method}, headers=headers) if body_file is not None: