From: Tim Peters Date: Mon, 8 Nov 2004 22:30:28 +0000 (+0000) Subject: _OutputRedirectingPdb.trace_dispatch(): Return the base class's X-Git-Tag: v2.4c1~60 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d7bbbbc594544318bc6d0f28cb376a11a326c22f;p=python _OutputRedirectingPdb.trace_dispatch(): Return the base class's trace_dispatch() result in a more obvious, and more robust way. --- diff --git a/Lib/doctest.py b/Lib/doctest.py index fb4f01b8e6..c6677f737b 100644 --- a/Lib/doctest.py +++ b/Lib/doctest.py @@ -348,10 +348,11 @@ class _OutputRedirectingPdb(pdb.Pdb): save_stdout = sys.stdout sys.stdout = self.__out # Call Pdb's trace dispatch method. - result = pdb.Pdb.trace_dispatch(self, *args) - # Restore stdout. - sys.stdout = save_stdout - return result + try: + return pdb.Pdb.trace_dispatch(self, *args) + finally: + # Restore stdout. + sys.stdout = save_stdout # [XX] Normalize with respect to os.path.pardir? def _module_relative_path(module, path):