]> granicus.if.org Git - python/commitdiff
SF bug [#473864] doctest expects spurios space.
authorTim Peters <tim.peters@gmail.com>
Tue, 23 Oct 2001 02:21:52 +0000 (02:21 +0000)
committerTim Peters <tim.peters@gmail.com>
Tue, 23 Oct 2001 02:21:52 +0000 (02:21 +0000)
Repair unlikely surprise due to magical softspace attr and the use of
print with a trailing comma in doctest examples.
Bugfix candidate.

Lib/doctest.py

index 91c51cb399b639e75e14e82cf42456b4338bfdaf..2829f1e62317579536578bf241e930716c379c70 100644 (file)
@@ -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