]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #18743: Fix references to non-existant "StringIO" module
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 29 Aug 2013 08:35:43 +0000 (11:35 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 29 Aug 2013 08:35:43 +0000 (11:35 +0300)
in docstrings and comments.

Lib/asynchat.py
Lib/gzip.py
Lib/tempfile.py
Lib/test/pickletester.py
Lib/test/test_httplib.py
Lib/test/test_logging.py
Misc/NEWS
Tools/gdb/libpython.py

index 4e26bb5856dcf1858881870b87ca14f04b3d76a3..eea3418762d6174520a9aa50b76184d2d64e7ff1 100644 (file)
@@ -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
index 67fe1d47c74bc8b07862b884c8487e91c68d653f..2fd03fa747f96d0f705fe71b0ea38f3d8cc38217 100644 (file)
@@ -144,7 +144,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.
 
index ed5c857a1df139f2b2a652c9c1861ecb02ab0d02..8a165ed1c1dfd5686e5a361301dcce7e8f8e4aee 100644 (file)
@@ -521,7 +521,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
index 342346291ed3a1f2b920f2654c61327b7933c697..052290d764054b27733b9e0a34f09fbfa549d700 100644 (file)
@@ -1547,14 +1547,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()
index 863e4bc22bc6b42dbf86580c687826cf0b74724a..769ab13fca7d12b1e809ed2352cb9733e5af0f6f 100644 (file)
@@ -51,8 +51,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.
@@ -324,7 +324,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():
@@ -337,7 +337,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)
index c9a051ae9f5725a3d9796fd2594bf4c2c89cf2a7..ae4ca184442c67bc8ca919ec341a1d6dbc09a84f 100644 (file)
@@ -156,12 +156,7 @@ class BaseTest(unittest.TestCase):
         the expected_values list of tuples."""
         stream = stream or self.stream
         pat = re.compile(self.expected_log_pat)
-        try:
-            stream.reset()
-            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)
index ea44b00bdc270451ae242c7bf2ad498e4731248e..be2dc9dde816f04a96f5e65376ba9e55ecd34af5 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -360,6 +360,8 @@ Tests
 Documentation
 -------------
 
+- Issue #18743: Fix references to non-existant "StringIO" module.
+
 - Issue #18783: Removed existing mentions of Python long type in docstrings,
   error messages and comments.
 
index 9f5e8b4e2c32f16cdbe7f76247c6cd0d8befe3a5..a85f50595cb259c9f827114d1852ea0cf88f2a1d 100644 (file)
@@ -121,7 +121,7 @@ class StringTruncated(RuntimeError):
     pass
 
 class TruncatedStringIO(object):
-    '''Similar to cStringIO, but can truncate the output by raising a
+    '''Similar to io.StringIO, but can truncate the output by raising a
     StringTruncated exception'''
     def __init__(self, maxlen=None):
         self._val = ''