mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
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.
This commit is contained in:
parent
90b689076a
commit
c77db34575
1 changed files with 6 additions and 0 deletions
|
@ -379,9 +379,15 @@ class _SpoofOut:
|
||||||
# that a trailing newline is missing.
|
# that a trailing newline is missing.
|
||||||
if guts and not guts.endswith("\n"):
|
if guts and not guts.endswith("\n"):
|
||||||
guts = guts + "\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
|
return guts
|
||||||
def clear(self):
|
def clear(self):
|
||||||
self.buf = []
|
self.buf = []
|
||||||
|
if hasattr(self, "softspace"):
|
||||||
|
del self.softspace
|
||||||
def flush(self):
|
def flush(self):
|
||||||
# JPython calls flush
|
# JPython calls flush
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue