From: Georg Brandl Date: Sun, 26 Jun 2005 22:23:44 +0000 (+0000) Subject: backport bug [ 1172785 ] doctest.script_from_examples() result sometimes un-exec... X-Git-Tag: v2.4.2c1~160 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0e65dd4efa310c742bf60e7c47dd6cf92f13c14e;p=thirdparty%2FPython%2Fcpython.git backport bug [ 1172785 ] doctest.script_from_examples() result sometimes un-exec-able --- diff --git a/Lib/doctest.py b/Lib/doctest.py index f621b62fe241..18125f6b4b4f 100644 --- a/Lib/doctest.py +++ b/Lib/doctest.py @@ -2494,7 +2494,8 @@ def script_from_examples(s): while output and output[0] == '#': output.pop(0) # Combine the output, and return it. - return '\n'.join(output) + # Add a courtesy newline to prevent exec from choking (see bug #1172785) + return '\n'.join(output) + '\n' def testsource(module, name): """Extract the test sources from a doctest docstring as a script.