diff options
author | Guido van Rossum <guido@python.org> | 2007-02-09 23:20:19 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-02-09 23:20:19 (GMT) |
commit | 79139b247b0bc0bc1b1a12932140bbd4bc188df7 (patch) | |
tree | fef7ef79dcb4e2a1ca033e725b1c2d802e9447d2 /Lib | |
parent | bdc36e4d9e754dd00f17f67a943217a1829c75b3 (diff) | |
download | cpython-79139b247b0bc0bc1b1a12932140bbd4bc188df7.zip cpython-79139b247b0bc0bc1b1a12932140bbd4bc188df7.tar.gz cpython-79139b247b0bc0bc1b1a12932140bbd4bc188df7.tar.bz2 |
Kill off softspace completely (except in formatter.py which seems to have
a different feature with the same name).
The change to test_doctest.txt reduces the doctest failures to 3.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/StringIO.py | 1 | ||||
-rw-r--r-- | Lib/bsddb/dbrecio.py | 1 | ||||
-rw-r--r-- | Lib/code.py | 16 | ||||
-rw-r--r-- | Lib/doctest.py | 8 | ||||
-rw-r--r-- | Lib/idlelib/PyShell.py | 2 | ||||
-rw-r--r-- | Lib/idlelib/run.py | 7 | ||||
-rw-r--r-- | Lib/socket.py | 3 | ||||
-rw-r--r-- | Lib/test/test_doctest.txt | 6 | ||||
-rw-r--r-- | Lib/test/test_file.py | 4 | ||||
-rw-r--r-- | Lib/test/test_inspect.py | 1 | ||||
-rw-r--r-- | Lib/test/test_softspace.py | 14 |
11 files changed, 6 insertions, 57 deletions
diff --git a/Lib/StringIO.py b/Lib/StringIO.py index a6b0ea4..189d368 100644 --- a/Lib/StringIO.py +++ b/Lib/StringIO.py @@ -60,7 +60,6 @@ class StringIO: self.buflist = [] self.pos = 0 self.closed = False - self.softspace = 0 def __iter__(self): return self diff --git a/Lib/bsddb/dbrecio.py b/Lib/bsddb/dbrecio.py index d439f32..975a2d9 100644 --- a/Lib/bsddb/dbrecio.py +++ b/Lib/bsddb/dbrecio.py @@ -39,7 +39,6 @@ class DBRecIO: self.len = None self.pos = 0 self.closed = 0 - self.softspace = 0 def close(self): if not self.closed: diff --git a/Lib/code.py b/Lib/code.py index 8532a2e..7182777 100644 --- a/Lib/code.py +++ b/Lib/code.py @@ -12,19 +12,6 @@ from codeop import CommandCompiler, compile_command __all__ = ["InteractiveInterpreter", "InteractiveConsole", "interact", "compile_command"] -def softspace(file, newvalue): - oldvalue = 0 - try: - oldvalue = file.softspace - except AttributeError: - pass - try: - file.softspace = newvalue - except (AttributeError, TypeError): - # "attribute-less object" or "read-only attributes" - pass - return oldvalue - class InteractiveInterpreter: """Base class for InteractiveConsole. @@ -105,9 +92,6 @@ class InteractiveInterpreter: raise except: self.showtraceback() - else: - if softspace(sys.stdout, 0): - print() def showsyntaxerror(self, filename=None): """Display the syntax error that just occurred. diff --git a/Lib/doctest.py b/Lib/doctest.py index 210e845..02e200d 100644 --- a/Lib/doctest.py +++ b/Lib/doctest.py @@ -240,16 +240,10 @@ class _SpoofOut(StringIO): # that a trailing newline is missing. if result and not result.endswith("\n"): result += "\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 result - def truncate(self, size=None): + def truncate(self, size=None): StringIO.truncate(self, size) - if hasattr(self, "softspace"): - del self.softspace # Worst-case linear-time ellipsis matching. def _ellipsis_match(want, got): diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index e8284d8..4c16db9 100644 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -1223,7 +1223,6 @@ class PyShell(OutputWindow): self.text.insert("end-1c", "\n") self.text.mark_set("iomark", "end-1c") self.set_line_and_column() - sys.stdout.softspace = 0 def write(self, s, tags=()): try: @@ -1242,7 +1241,6 @@ class PseudoFile(object): def __init__(self, shell, tags, encoding=None): self.shell = shell self.tags = tags - self.softspace = 0 self.encoding = encoding def write(self, s): diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py index fa201a8..8a0b926 100644 --- a/Lib/idlelib/run.py +++ b/Lib/idlelib/run.py @@ -190,12 +190,7 @@ def cleanup_traceback(tb, exclude): tb[i] = fn, ln, nm, line def flush_stdout(): - try: - if sys.stdout.softspace: - sys.stdout.softspace = 0 - sys.stdout.write("\n") - except (AttributeError, EOFError): - pass + """XXX How to do this now?""" def exit(): """Exit subprocess, possibly after first deleting sys.exitfunc diff --git a/Lib/socket.py b/Lib/socket.py index eff47d2..2222600 100644 --- a/Lib/socket.py +++ b/Lib/socket.py @@ -202,7 +202,7 @@ class _fileobject(object): default_bufsize = 8192 name = "<socket>" - __slots__ = ["mode", "bufsize", "softspace", + __slots__ = ["mode", "bufsize", # "closed" is a property, see below "_sock", "_rbufsize", "_wbufsize", "_rbuf", "_wbuf", "_close"] @@ -213,7 +213,6 @@ class _fileobject(object): if bufsize < 0: bufsize = self.default_bufsize self.bufsize = bufsize - self.softspace = False if bufsize == 0: self._rbufsize = 1 elif bufsize == 1: diff --git a/Lib/test/test_doctest.txt b/Lib/test/test_doctest.txt index f8e851e..23446d1 100644 --- a/Lib/test/test_doctest.txt +++ b/Lib/test/test_doctest.txt @@ -9,9 +9,9 @@ already: We can make this fail by disabling the blank-line feature. >>> if 1: - ... print 'a' - ... print - ... print 'b' + ... print('a') + ... print() + ... print('b') a <BLANKLINE> b diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py index 91f6e76..7eb052b 100644 --- a/Lib/test/test_file.py +++ b/Lib/test/test_file.py @@ -30,14 +30,10 @@ class AutoFileTests(unittest.TestCase): def testAttributes(self): # verify expected attributes exist f = self.f - softspace = f.softspace f.name # merely shouldn't blow up f.mode # ditto f.closed # ditto - # verify softspace is writable - f.softspace = softspace # merely shouldn't blow up - # verify the others aren't for attr in 'name', 'mode', 'closed': self.assertRaises((AttributeError, TypeError), setattr, f, attr, 'oops') diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index 071e521..296e259 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -61,7 +61,6 @@ class TestPredicates(IsTestBase): self.istest(inspect.ismodule, 'mod') self.istest(inspect.istraceback, 'tb') self.istest(inspect.isdatadescriptor, '__builtin__.file.closed') - self.istest(inspect.isdatadescriptor, '__builtin__.file.softspace') if hasattr(types, 'GetSetDescriptorType'): self.istest(inspect.isgetsetdescriptor, 'type(tb.tb_frame).f_locals') diff --git a/Lib/test/test_softspace.py b/Lib/test/test_softspace.py deleted file mode 100644 index c0b4e8f..0000000 --- a/Lib/test/test_softspace.py +++ /dev/null @@ -1,14 +0,0 @@ -from test import test_support -import StringIO - -# SF bug 480215: softspace confused in nested print -f = StringIO.StringIO() -class C: - def __str__(self): - print('a', file=f) - return 'b' - -print(C(), 'c ', 'd\t', 'e', file=f) -print('f', 'g', file=f) -# In 2.2 & earlier, this printed ' a\nbc d\te\nf g\n' -test_support.vereq(f.getvalue(), 'a\nb c d\te\nf g\n') |