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

Skip to content

Commit 34d1928

Browse files
committed
SF patch# 1770008 by Christian Heimes (plus some extras).
Completely get rid of StringIO.py and cStringIO.c. I had to fix a few tests and modules beyond what Christian did, and invent a few conventions. E.g. in elementtree, I chose to write/return Unicode strings whe no encoding is given, but bytes when an explicit encoding is given. Also mimetools was made to always assume binary files.
1 parent 918f49e commit 34d1928

78 files changed

Lines changed: 312 additions & 657 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Doc/tools/indfix.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
__version__ = '$Revision$'
2020

2121
import re
22-
import StringIO
22+
import io
2323
import sys
2424

2525

@@ -50,7 +50,7 @@ def process(ifn, ofn=None):
5050
ifp = open(ifn)
5151
if ofn is None:
5252
ofn = ifn
53-
ofp = StringIO.StringIO()
53+
ofp = io.StringIO()
5454
entries = []
5555
match = breakable_re.match
5656
write = ofp.write

Doc/tools/sgmlconv/docfixer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,8 +1055,8 @@ def main():
10551055
ofp = sys.stdout
10561056
elif len(sys.argv) == 3:
10571057
ifp = open(sys.argv[1])
1058-
import StringIO
1059-
ofp = StringIO.StringIO()
1058+
import io
1059+
ofp = io.StringIO()
10601060
else:
10611061
usage()
10621062
sys.exit(2)

Lib/StringIO.py

Lines changed: 0 additions & 324 deletions
This file was deleted.

Lib/bsddb/test/test_compare.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44

55
import sys, os, re
6-
from cStringIO import StringIO
6+
from io import StringIO
77

88
from . import test_all
99

Lib/cookielib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def _warn_unhandled_exception():
5858
# catching input that's bad in unexpected ways. Warn if any
5959
# exceptions are caught there.
6060
import warnings, traceback, StringIO
61-
f = StringIO.StringIO()
61+
f = io.StringIO()
6262
traceback.print_exc(None, f)
6363
msg = f.getvalue()
6464
warnings.warn("cookielib bug!\n%s" % msg, stacklevel=2)

Lib/ctypes/test/test_random_things.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ class CallbackTracbackTestCase(unittest.TestCase):
3737

3838
def capture_stderr(self, func, *args, **kw):
3939
# helper - call function 'func', and return the captured stderr
40-
import StringIO
40+
import io
4141
old_stderr = sys.stderr
42-
logger = sys.stderr = StringIO.StringIO()
42+
logger = sys.stderr = io.StringIO()
4343
try:
4444
func(*args, **kw)
4545
finally:

0 commit comments

Comments
 (0)