From: Tim Peters Date: Tue, 23 Oct 2001 02:21:52 +0000 (+0000) Subject: SF bug [#473864] doctest expects spurios space. X-Git-Tag: v2.2.1c1~1096 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c77db34575f8ea73a5f53baf5a68fb0d39850573;p=python 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. --- diff --git a/Lib/doctest.py b/Lib/doctest.py index 91c51cb399..2829f1e623 100644 --- a/Lib/doctest.py +++ b/Lib/doctest.py @@ -379,9 +379,15 @@ class _SpoofOut: # that a trailing newline is missing. 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 pass