[Python-checkins] python/dist/src/Lib doctest.py, 1.120.2.1, 1.120.2.2

birkenfeld@users.sourceforge.net birkenfeld at users.sourceforge.net
Mon Jun 27 00:23:46 CEST 2005


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15362/Lib

Modified Files:
      Tag: release24-maint
	doctest.py 
Log Message:
backport bug [ 1172785 ] doctest.script_from_examples() result sometimes un-exec-able



Index: doctest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/doctest.py,v
retrieving revision 1.120.2.1
retrieving revision 1.120.2.2
diff -u -d -r1.120.2.1 -r1.120.2.2
--- doctest.py	29 Mar 2005 12:35:54 -0000	1.120.2.1
+++ doctest.py	26 Jun 2005 22:23:44 -0000	1.120.2.2
@@ -2494,7 +2494,8 @@
     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.



More information about the Python-checkins mailing list