From 753ddcfbf7c889aba4a26cc3701f274563d24e75 2019-10-05 18:35:38 From: Joris Van den Bossche Date: 2019-10-05 18:35:38 Subject: [PATCH] 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)