From 9f3cbf7706e98a33fa6006f2468c7d1fe3b161d5 Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Fri, 29 Jun 2018 11:23:07 +0100 Subject: [PATCH] Replace 'raise StopIteration' with 'return' With PEP 479, the behaviour of StopIteration is changing. Raising it to stop a generator is considered incorrect and from Python 3.7 this will cause a RuntimeError. The PEP recommends using the return statement. More details: https://www.python.org/dev/peps/pep-0479/#examples-of-breakage Change-Id: I7b35bc0525b599950a7fa0e58caeffcedb6bd18b --- tripleoclient/workflows/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tripleoclient/workflows/base.py b/tripleoclient/workflows/base.py index 9efe1d245..2ac0aaf72 100644 --- a/tripleoclient/workflows/base.py +++ b/tripleoclient/workflows/base.py @@ -71,7 +71,7 @@ def wait_for_messages(mistral, websocket, execution, timeout=None): # Workflows should end with SUCCESS or ERROR statuses. if payload.get('status', 'RUNNING') != "RUNNING" or \ mistral.executions.get(execution.id).state != "RUNNING": - raise StopIteration + return except exceptions.WebSocketTimeout: check_execution_status(mistral, execution.id) raise