diff options
author | Tim Peters <tim.peters@gmail.com> | 2004-11-08 22:30:28 +0000 |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2004-11-08 22:30:28 +0000 |
commit | 9a2e53a3284492ec29b29db5f8153432c3bcae8b (patch) | |
tree | aabb7b0b4d2b2bb8c4de7513333bc6695df60e17 /Lib/doctest.py | |
parent | 4bb6e1e2593f2310a2b28ca32731e1b27a5c6208 (diff) | |
download | cpython-9a2e53a3284492ec29b29db5f8153432c3bcae8b.tar.gz |
_OutputRedirectingPdb.trace_dispatch(): Return the base class's
trace_dispatch() result in a more obvious, and more robust way.
Diffstat (limited to 'Lib/doctest.py')
-rw-r--r-- | Lib/doctest.py | 9 |
1 files changed, 5 insertions, 4 deletions
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): |