[Python-checkins] CVS: python/dist/src/Lib doctest.py,1.20,1.21

Tim Peters tim_one@users.sourceforge.net
Mon, 22 Oct 2001 19:21:54 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv26862/python/Lib

Modified Files:
	doctest.py 
Log Message:
SF bug [#473864] doctest expects spurios space.
Repair unlikely surprise due to magical softspace attr and the use of
print with a trailing comma in doctest examples.
Bugfix candidate.


Index: doctest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/doctest.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** doctest.py	2001/10/03 04:08:26	1.20
--- doctest.py	2001/10/23 02:21:52	1.21
***************
*** 380,386 ****
--- 380,392 ----
          if guts and not guts.endswith("\n"):
              guts = guts + "\n"
+         # Prevent softspace from screwing up the next test case, in
+         # case they used print with a trailing comma in an example.
+         if hasattr(self, "softspace"):
+             del self.softspace
          return guts
      def clear(self):
          self.buf = []
+         if hasattr(self, "softspace"):
+             del self.softspace
      def flush(self):
          # JPython calls flush