From 2538c4810a0c8d3558fd7afd9253b59c748ea25f Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Thu, 26 Dec 2013 18:05:21 -0800 Subject: [PATCH] Bind outside of the try block If binding fails, we don't want to unbind since there will be nothing bound, so do the binding outside of the try/except block to do this in the correct order. Change-Id: Iebd3ea7a04265264043c47d4e943778538e8a153 --- taskflow/engines/action_engine/executor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taskflow/engines/action_engine/executor.py b/taskflow/engines/action_engine/executor.py index 1e40f590..b771dc4c 100644 --- a/taskflow/engines/action_engine/executor.py +++ b/taskflow/engines/action_engine/executor.py @@ -29,8 +29,8 @@ from taskflow.utils import threading_utils @contextlib.contextmanager def _autobind(task, bind_name, bind_func, **kwargs): + task.bind(bind_name, bind_func, **kwargs) try: - task.bind(bind_name, bind_func, **kwargs) yield task finally: task.unbind(bind_name, bind_func)