test_doctest.py test_pdb_set_trace_nested(): A new test from Jim Fulton
showing that doctest's pdb.set_trace() support was dramatically broken.
doctest.py _OutputRedirectingPdb.trace_dispatch(): Return a local trace
function instead of (implicitly) None. Else interaction with pdb was
bizarre, noticing only 'call' events. Amazingly, the existing set_trace()
tests didn't care.
diff --git a/Lib/doctest.py b/Lib/doctest.py
index a8162f3..fb4f01b 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -105,8 +105,6 @@
warnings.filterwarnings("ignore", "is_private", DeprecationWarning,
__name__, 0)
-real_pdb_set_trace = pdb.set_trace
-
# There are 4 basic classes:
# - Example: a <source, want> pair, plus an intra-docstring line number.
# - DocTest: a collection of examples, parsed from a docstring, plus
@@ -350,9 +348,10 @@
save_stdout = sys.stdout
sys.stdout = self.__out
# Call Pdb's trace dispatch method.
- pdb.Pdb.trace_dispatch(self, *args)
+ result = pdb.Pdb.trace_dispatch(self, *args)
# Restore stdout.
sys.stdout = save_stdout
+ return result
# [XX] Normalize with respect to os.path.pardir?
def _module_relative_path(module, path):