summaryrefslogtreecommitdiffstats
path: root/Lib/doctest.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-11-08 22:30:28 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-11-08 22:30:28 (GMT)
commitd7bbbbc594544318bc6d0f28cb376a11a326c22f (patch)
treed64e4fecd7f5fb2b3531655867e4cab9f473e5e9 /Lib/doctest.py
parent50c6bdb1d6f5344fcaa772c6a1a37c09bbe55bf6 (diff)
downloadcpython-d7bbbbc594544318bc6d0f28cb376a11a326c22f.zip
cpython-d7bbbbc594544318bc6d0f28cb376a11a326c22f.tar.gz
cpython-d7bbbbc594544318bc6d0f28cb376a11a326c22f.tar.bz2
_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.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py
index fb4f01b..c6677f7 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):