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

Anthony Baxter anthonybaxter@users.sourceforge.net
2001年12月04日 21:19:53 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv14259
Modified Files:
 Tag: release21-maint
	doctest.py 
Log Message:
backport of 1.21
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.
Index: doctest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/doctest.py,v
retrieving revision 1.10.2.1
retrieving revision 1.10.2.2
diff -C2 -d -r1.10.2.1 -r1.10.2.2
*** doctest.py	2001年06月27日 15:07:17	1.10.2.1
--- doctest.py	2001年12月05日 05:19:51	1.10.2.2
***************
*** 451,457 ****
--- 451,463 ----
 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

AltStyle によって変換されたページ (->オリジナル) /