diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-08-29 08:39:48 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-08-29 08:39:48 (GMT) |
commit | 48e6a8c88a69adbdc7c3bf9adef5696828b1c5fe (patch) | |
tree | 45c7d23b65375342454fa469c9479b22f6c69a77 /Lib | |
parent | a8c2a8aa8dcf236355348adf696d2aae8fbe45b2 (diff) | |
parent | 50254c57cd7a562441b7ff385d59c0255301f3ff (diff) | |
download | cpython-48e6a8c88a69adbdc7c3bf9adef5696828b1c5fe.zip cpython-48e6a8c88a69adbdc7c3bf9adef5696828b1c5fe.tar.gz cpython-48e6a8c88a69adbdc7c3bf9adef5696828b1c5fe.tar.bz2 |
Issue #18743: Fix references to non-existant "StringIO" module
in docstrings and comments.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/asynchat.py | 9 | ||||
-rw-r--r-- | Lib/gzip.py | 2 | ||||
-rw-r--r-- | Lib/tempfile.py | 2 | ||||
-rw-r--r-- | Lib/test/pickletester.py | 4 | ||||
-rw-r--r-- | Lib/test/test_httplib.py | 8 | ||||
-rw-r--r-- | Lib/test/test_logging.py | 10 |
6 files changed, 12 insertions, 23 deletions
diff --git a/Lib/asynchat.py b/Lib/asynchat.py index f055d63..0378fa7 100644 --- a/Lib/asynchat.py +++ b/Lib/asynchat.py @@ -69,12 +69,9 @@ class async_chat (asyncore.dispatcher): # for string terminator matching self.ac_in_buffer = b'' - # we use a list here rather than cStringIO for a few reasons... - # del lst[:] is faster than sio.truncate(0) - # lst = [] is faster than sio.truncate(0) - # cStringIO will be gaining unicode support in py3k, which - # will negatively affect the performance of bytes compared to - # a ''.join() equivalent + # we use a list here rather than io.BytesIO for a few reasons... + # del lst[:] is faster than bio.truncate(0) + # lst = [] is faster than bio.truncate(0) self.incoming = [] # we toss the use of the "simple producer" and replace it with diff --git a/Lib/gzip.py b/Lib/gzip.py index d2d6dd6..b073a66 100644 --- a/Lib/gzip.py +++ b/Lib/gzip.py @@ -141,7 +141,7 @@ class GzipFile(io.BufferedIOBase): non-trivial value. The new class instance is based on fileobj, which can be a regular - file, a StringIO object, or any other object which simulates a file. + file, an io.BytesIO object, or any other object which simulates a file. It defaults to None, in which case filename is opened to provide a file object. diff --git a/Lib/tempfile.py b/Lib/tempfile.py index 1eff59c..1eed23a 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -501,7 +501,7 @@ class SpooledTemporaryFile: # The method caching trick from NamedTemporaryFile # won't work here, because _file may change from a - # _StringIO instance to a real file. So we list + # BytesIO/StringIO instance to a real file. So we list # all the methods directly. # Context management protocol diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py index 7e6e758..1971120 100644 --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -1552,14 +1552,14 @@ class AbstractPicklerUnpicklerObjectTests(unittest.TestCase): pickler.dump(data) first_pickled = f.getvalue() - # Reset StringIO object. + # Reset BytesIO object. f.seek(0) f.truncate() pickler.dump(data) second_pickled = f.getvalue() - # Reset the Pickler and StringIO objects. + # Reset the Pickler and BytesIO objects. pickler.clear_memo() f.seek(0) f.truncate() diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index b3688af..778e919 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -53,8 +53,8 @@ class EPipeSocket(FakeSocket): def close(self): pass -class NoEOFStringIO(io.BytesIO): - """Like StringIO, but raises AssertionError on EOF. +class NoEOFBytesIO(io.BytesIO): + """Like BytesIO, but raises AssertionError on EOF. This is used below to test that http.client doesn't try to read more from the underlying file than it should. @@ -326,7 +326,7 @@ class BasicTest(TestCase): 'HTTP/1.1 200 OK\r\n' 'Content-Length: 14432\r\n' '\r\n', - NoEOFStringIO) + NoEOFBytesIO) resp = client.HTTPResponse(sock, method="HEAD") resp.begin() if resp.read(): @@ -339,7 +339,7 @@ class BasicTest(TestCase): 'HTTP/1.1 200 OK\r\n' 'Content-Length: 14432\r\n' '\r\n', - NoEOFStringIO) + NoEOFBytesIO) resp = client.HTTPResponse(sock, method="HEAD") resp.begin() b = bytearray(5) diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 63d49fe..eed67d0 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -160,15 +160,7 @@ class BaseTest(unittest.TestCase): the expected_values list of tuples.""" stream = stream or self.stream pat = re.compile(pat or self.expected_log_pat) - try: - if hasattr(stream, 'reset'): - stream.reset() - elif hasattr(stream, 'seek'): - stream.seek(0) - actual_lines = stream.readlines() - except AttributeError: - # StringIO.StringIO lacks a reset() method. - actual_lines = stream.getvalue().splitlines() + actual_lines = stream.getvalue().splitlines() self.assertEqual(len(actual_lines), len(expected_values)) for actual, expected in zip(actual_lines, expected_values): match = pat.search(actual) |