From ae961ecb0452359ec5ff8881769daae0ae6e3847 2019-11-12 02:38:24 From: Matthias Bussonnier Date: 2019-11-12 02:38:24 Subject: [PATCH] Merge pull request #11905 from jorisvandenbossche/fix-directive-truncate IPython directive: correctly clear cout --- diff --git a/IPython/sphinxext/ipython_directive.py b/IPython/sphinxext/ipython_directive.py index 60c1b51..0481624 100644 --- a/IPython/sphinxext/ipython_directive.py +++ b/IPython/sphinxext/ipython_directive.py @@ -585,7 +585,7 @@ class EmbeddedSphinxShell(object): if self.warning_is_error: raise RuntimeError('Non Expected warning in `{}` line {}'.format(filename, lineno)) - self.cout.truncate(0) + self.clear_cout() return (ret, input_lines, processed_output, is_doctest, decorator, image_file, image_directive)