This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author barry
Recipients Marc.Abramowitz, alex, barry, belopolsky, ezio.melotti, ncoghlan, nikratio, pitrou, rhettinger, vstinner
Date 2013-07-23.12:53:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <20130723085332.092ff7ec@anarchist>
In-reply-to <1374553476.03.0.407785357312.issue15805@psf.upfronthosting.co.za>
Content
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
:)
History
Date User Action Args
2013-07-23 12:53:35barrysetrecipients: + barry, rhettinger, ncoghlan, belopolsky, pitrou, vstinner, ezio.melotti, alex, nikratio, Marc.Abramowitz
2013-07-23 12:53:35barrylinkissue15805 messages
2013-07-23 12:53:35barrycreate