Barry A. Warsaw added the comment: On Jul 23, 2013, at 04:24 AM, Alexander Belopolsky wrote:
>@contextlib.contextmanager >def redirect_stdout(stream): > old_stdout = sys.stdout > sys.stdout = stream > yield > sys.stdout = old_stdout Make that: @contextlib.contextmanager def redirect_stdout(stream): old_stdout = sys.stdout sys.stdout = stream try: yield finally: sys.stdout = old_stdout and I'll be able to remove those 8 lines of code from all my other code bases :) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15805> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com