Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 50254c5

Browse files
Issue python#18743: Fix references to non-existant "StringIO" module
in docstrings and comments.
1 parent 15e6590 commit 50254c5

8 files changed

Lines changed: 15 additions & 21 deletions

File tree

Lib/asynchat.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,9 @@ def __init__ (self, sock=None, map=None):
6969
# for string terminator matching
7070
self.ac_in_buffer = b''
7171

72-
# we use a list here rather than cStringIO for a few reasons...
73-
# del lst[:] is faster than sio.truncate(0)
74-
# lst = [] is faster than sio.truncate(0)
75-
# cStringIO will be gaining unicode support in py3k, which
76-
# will negatively affect the performance of bytes compared to
77-
# a ''.join() equivalent
72+
# we use a list here rather than io.BytesIO for a few reasons...
73+
# del lst[:] is faster than bio.truncate(0)
74+
# lst = [] is faster than bio.truncate(0)
7875
self.incoming = []
7976

8077
# we toss the use of the "simple producer" and replace it with

Lib/gzip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def __init__(self, filename=None, mode=None,
144144
non-trivial value.
145145
146146
The new class instance is based on fileobj, which can be a regular
147-
file, a StringIO object, or any other object which simulates a file.
147+
file, an io.BytesIO object, or any other object which simulates a file.
148148
It defaults to None, in which case filename is opened to provide
149149
a file object.
150150

Lib/tempfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ def rollover(self):
521521

522522
# The method caching trick from NamedTemporaryFile
523523
# won't work here, because _file may change from a
524-
# _StringIO instance to a real file. So we list
524+
# BytesIO/StringIO instance to a real file. So we list
525525
# all the methods directly.
526526

527527
# Context management protocol

Lib/test/pickletester.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,14 +1547,14 @@ def test_clear_pickler_memo(self):
15471547
pickler.dump(data)
15481548
first_pickled = f.getvalue()
15491549

1550-
# Reset StringIO object.
1550+
# Reset BytesIO object.
15511551
f.seek(0)
15521552
f.truncate()
15531553

15541554
pickler.dump(data)
15551555
second_pickled = f.getvalue()
15561556

1557-
# Reset the Pickler and StringIO objects.
1557+
# Reset the Pickler and BytesIO objects.
15581558
pickler.clear_memo()
15591559
f.seek(0)
15601560
f.truncate()

Lib/test/test_httplib.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ def sendall(self, data):
5151
def close(self):
5252
pass
5353

54-
class NoEOFStringIO(io.BytesIO):
55-
"""Like StringIO, but raises AssertionError on EOF.
54+
class NoEOFBytesIO(io.BytesIO):
55+
"""Like BytesIO, but raises AssertionError on EOF.
5656
5757
This is used below to test that http.client doesn't try to read
5858
more from the underlying file than it should.
@@ -324,7 +324,7 @@ def test_read_head(self):
324324
'HTTP/1.1 200 OK\r\n'
325325
'Content-Length: 14432\r\n'
326326
'\r\n',
327-
NoEOFStringIO)
327+
NoEOFBytesIO)
328328
resp = client.HTTPResponse(sock, method="HEAD")
329329
resp.begin()
330330
if resp.read():
@@ -337,7 +337,7 @@ def test_readinto_head(self):
337337
'HTTP/1.1 200 OK\r\n'
338338
'Content-Length: 14432\r\n'
339339
'\r\n',
340-
NoEOFStringIO)
340+
NoEOFBytesIO)
341341
resp = client.HTTPResponse(sock, method="HEAD")
342342
resp.begin()
343343
b = bytearray(5)

Lib/test/test_logging.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,7 @@ def assert_log_lines(self, expected_values, stream=None):
156156
the expected_values list of tuples."""
157157
stream = stream or self.stream
158158
pat = re.compile(self.expected_log_pat)
159-
try:
160-
stream.reset()
161-
actual_lines = stream.readlines()
162-
except AttributeError:
163-
# StringIO.StringIO lacks a reset() method.
164-
actual_lines = stream.getvalue().splitlines()
159+
actual_lines = stream.getvalue().splitlines()
165160
self.assertEqual(len(actual_lines), len(expected_values))
166161
for actual, expected in zip(actual_lines, expected_values):
167162
match = pat.search(actual)

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,8 @@ Tests
360360
Documentation
361361
-------------
362362

363+
- Issue #18743: Fix references to non-existant "StringIO" module.
364+
363365
- Issue #18783: Removed existing mentions of Python long type in docstrings,
364366
error messages and comments.
365367

Tools/gdb/libpython.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class StringTruncated(RuntimeError):
121121
pass
122122

123123
class TruncatedStringIO(object):
124-
'''Similar to cStringIO, but can truncate the output by raising a
124+
'''Similar to io.StringIO, but can truncate the output by raising a
125125
StringTruncated exception'''
126126
def __init__(self, maxlen=None):
127127
self._val = ''

0 commit comments

Comments
 (0)