diff --git a/IPython/ultraTB.py b/IPython/ultraTB.py index 9d02773..ce4c740 100644 --- a/IPython/ultraTB.py +++ b/IPython/ultraTB.py @@ -60,7 +60,7 @@ You can implement other color schemes easily, the syntax is fairly self-explanatory. Please send back new schemes you develop to the author for possible inclusion in future releases. -$Id: ultraTB.py 1956 2006-11-30 05:22:31Z fperez $""" +$Id: ultraTB.py 2027 2007-01-19 00:55:09Z fperez $""" #***************************************************************************** # Copyright (C) 2001 Nathaniel Gray @@ -248,6 +248,8 @@ class ListTB(TBTools): TBTools.__init__(self,color_scheme = color_scheme,call_pdb=0) def __call__(self, etype, value, elist): + Term.cout.flush() + Term.cerr.flush() print >> Term.cerr, self.text(etype,value,elist) def text(self,etype, value, elist,context=5): @@ -716,6 +718,8 @@ class VerboseTB(TBTools): def handler(self, info=None): (etype, evalue, etb) = info or sys.exc_info() self.tb = etb + Term.cout.flush() + Term.cerr.flush() print >> Term.cerr, self.text(etype, evalue, etb) # Changed so an instance can just be called as VerboseTB_inst() and print @@ -833,6 +837,8 @@ class AutoFormattedTB(FormattedTB): if out is None: out = Term.cerr + Term.cout.flush() + out.flush() if tb_offset is not None: tb_offset, self.tb_offset = self.tb_offset, tb_offset print >> out, self.text(etype, evalue, etb) diff --git a/doc/ChangeLog b/doc/ChangeLog index c21b483..606cb6f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,9 @@ +2007-01-17 Fernando Perez + + * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush + all output streams before printing tracebacks. This ensures that + user output doesn't end up interleaved with traceback output. + 2007-01-10 Ville Vainio * Extensions/envpersist.py: Turbocharged %env that remembers