]> granicus.if.org Git - python/commitdiff
_OutputRedirectingPdb.trace_dispatch(): Return the base class's
authorTim Peters <tim.peters@gmail.com>
Mon, 8 Nov 2004 22:30:28 +0000 (22:30 +0000)
committerTim Peters <tim.peters@gmail.com>
Mon, 8 Nov 2004 22:30:28 +0000 (22:30 +0000)
trace_dispatch() result in a more obvious, and more robust way.

Lib/doctest.py

index fb4f01b8e63828ec2f2993b49d8fca819bdceff8..c6677f737b815a24ea6b6f5138ba529eb29d4de5 100644 (file)
@@ -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):