]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport of 1.21
authorAnthony Baxter <anthonybaxter@gmail.com>
Wed, 5 Dec 2001 05:19:51 +0000 (05:19 +0000)
committerAnthony Baxter <anthonybaxter@gmail.com>
Wed, 5 Dec 2001 05:19:51 +0000 (05:19 +0000)
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.

Lib/doctest.py

index c52a2955a7a08f265457ed4ef8e771160f7e81c8..942363e762b67257a343f807f936e01a90f8956d 100644 (file)
@@ -450,9 +450,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