[Python-checkins] python/dist/src/Lib doctest.py,1.56,1.57
tim_one at users.sourceforge.net
tim_one at users.sourceforge.net
Mon Aug 9 18:43:38 CEST 2004
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3910/Lib
Modified Files:
doctest.py
Log Message:
Edward's latest checkins somehow managed to wipe out my previous latest
checkins. Reapplying the latter changes.
Index: doctest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/doctest.py,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -d -r1.56 -r1.57
*** doctest.py 9 Aug 2004 16:14:41 -0000 1.56
--- doctest.py 9 Aug 2004 16:43:36 -0000 1.57
***************
*** 1260,1284 ****
compileflags = _extract_future_flags(test.globs)
if out is None:
! out = sys.stdout.write
! saveout = sys.stdout
! # Note that don't save away the previous pdb.set_trace. Rather,
! # we safe pdb.set_trace on import (see import section above).
! # We then call and restore that original cersion. We do it this
! # way to make this feature testable. If we kept and called the
! # previous version, we'd end up restoring the original stdout,
! # which is not what we want.
def set_trace():
! sys.stdout = saveout
real_pdb_set_trace()
try:
- sys.stdout = self._fakeout
- pdb.set_trace = set_trace
return self.__run(test, compileflags, out)
finally:
! sys.stdout = saveout
! pdb.set_trace = real_pdb_set_trace
if clear_globs:
test.globs.clear()
--- 1260,1287 ----
compileflags = _extract_future_flags(test.globs)
+ save_stdout = sys.stdout
if out is None:
! out = save_stdout.write
! sys.stdout = self._fakeout
! # Patch pdb.set_trace to restore sys.stdout, so that interactive
! # debugging output is visible (not still redirected to self._fakeout).
! # Note that we run "the real" pdb.set_trace (captured at doctest
! # import time) in our replacement. Because the current run() may
! # run another doctest (and so on), the current pdb.set_trace may be
! # our set_trace function, which changes sys.stdout. If we called
! # a chain of those, we wouldn't be left with the save_stdout
! # *this* run() invocation wants.
def set_trace():
! sys.stdout = save_stdout
real_pdb_set_trace()
+ save_set_trace = pdb.set_trace
+ pdb.set_trace = set_trace
try:
return self.__run(test, compileflags, out)
finally:
! sys.stdout = save_stdout
! pdb.set_trace = save_set_trace
if clear_globs:
test.globs.clear()
More information about the Python-checkins
mailing list