From 7ee2ebfa7db62290c8bbad099f3402aa32a35aac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Taveira=20Ara=C3=BAjo?= Date: Fri, 4 Jul 2014 18:45:19 +0100 Subject: [PATCH] Always dedent when leaving indent context manager. --- clint/textui/core.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clint/textui/core.py b/clint/textui/core.py index c435391..b61e2c1 100644 --- a/clint/textui/core.py +++ b/clint/textui/core.py @@ -79,8 +79,10 @@ def dedent(): @contextmanager def _indent_context(): """Indentation context manager.""" - yield - dedent() + try: + yield + finally: + dedent() def indent(indent=4, quote=''): """Indentation manager, return an indentation context manager."""