Index: lldb/examples/customization/bin-utils/binutils.py =================================================================== --- lldb/examples/customization/bin-utils/binutils.py +++ lldb/examples/customization/bin-utils/binutils.py @@ -1,7 +1,5 @@ "Collection of tools for displaying bit representation of numbers.""" -import StringIO - from __future__ import print_function def binary(n, width=None): Index: lldb/examples/python/mach_o.py =================================================================== --- lldb/examples/python/mach_o.py +++ lldb/examples/python/mach_o.py @@ -8,7 +8,7 @@ import re import struct import string -import StringIO +import io import sys import uuid @@ -1054,7 +1054,7 @@ if options.extract_modules: # print "Extracting modules from mach file..." data = file_extract.FileExtract( - StringIO.StringIO(sect_bytes), self.data.byte_order) + io.BytesIO(sect_bytes), self.data.byte_order) version = data.get_uint32() num_modules = data.get_uint32() # print "version = %u, num_modules = %u" % Index: lldb/utils/git-svn/convert.py =================================================================== --- lldb/utils/git-svn/convert.py +++ lldb/utils/git-svn/convert.py @@ -16,7 +16,7 @@ import os import re import sys -import StringIO +import io def usage(problem_file=None): @@ -37,7 +37,7 @@ content = f_in.read() # The new content to be written back to the same file. - new_content = StringIO.StringIO() + new_content = io.StringIO() # Boolean flag controls whether to start printing lines. from_header_seen = False Index: lldb/utils/lui/lldbutil.py =================================================================== --- lldb/utils/lui/lldbutil.py +++ lldb/utils/lui/lldbutil.py @@ -17,7 +17,7 @@ import lldb import os import sys -import StringIO +import io # =================================================== # Utilities for locating/checking executable programs @@ -52,7 +52,7 @@ It returns the disassembly content in a string object. """ - buf = StringIO.StringIO() + buf = io.StringIO() insts = function_or_symbol.GetInstructions(target) for i in insts: print(i, file=buf) @@ -776,7 +776,7 @@ def print_stacktrace(thread, string_buffer=False): """Prints a simple stack trace of this thread.""" - output = StringIO.StringIO() if string_buffer else sys.stdout + output = io.StringIO() if string_buffer else sys.stdout target = thread.GetProcess().GetTarget() depth = thread.GetNumFrames() @@ -819,7 +819,7 @@ def print_stacktraces(process, string_buffer=False): """Prints the stack traces of all the threads.""" - output = StringIO.StringIO() if string_buffer else sys.stdout + output = io.StringIO() if string_buffer else sys.stdout print("Stack traces for " + str(process), file=output) @@ -879,7 +879,7 @@ def print_registers(frame, string_buffer=False): """Prints all the register sets of the frame.""" - output = StringIO.StringIO() if string_buffer else sys.stdout + output = io.StringIO() if string_buffer else sys.stdout print("Register sets for " + str(frame), file=output) @@ -962,7 +962,7 @@ def format(self, value, buffer=None, indent=0): if not buffer: - output = StringIO.StringIO() + output = io.StringIO() else: output = buffer # If there is a summary, it suffices. @@ -992,7 +992,7 @@ def format(self, value, buffer=None): if not buffer: - output = StringIO.StringIO() + output = io.StringIO() else: output = buffer @@ -1019,7 +1019,7 @@ def format(self, value, buffer=None): if not buffer: - output = StringIO.StringIO() + output = io.StringIO() else: output = buffer Index: lldb/utils/misc/grep-svn-log.py =================================================================== --- lldb/utils/misc/grep-svn-log.py +++ lldb/utils/misc/grep-svn-log.py @@ -13,7 +13,7 @@ import fileinput import re import sys -import StringIO +import io # Separator string for "svn log -v" output. separator = '-' * 72 @@ -23,7 +23,7 @@ svn log -v | grep-svn-log.py '^ D.+why_are_you_missing.h'""" -class Log(StringIO.StringIO): +class Log(io.StringIO): """Simple facade to keep track of the log content.""" def __init__(self): Index: lldb/utils/sync-source/syncsource.py =================================================================== --- lldb/utils/sync-source/syncsource.py +++ lldb/utils/sync-source/syncsource.py @@ -11,7 +11,7 @@ """ import argparse -import cStringIO +import io import importlib import json import os.path @@ -89,11 +89,11 @@ # preserving the line count. regex = re.compile(r"#.*$") - comment_stripped_file = cStringIO.StringIO() + comment_stripped_file = io.StringIO() with open(filename, "r") as json_file: for line in json_file: comment_stripped_file.write(regex.sub("", line)) - return json.load(cStringIO.StringIO(comment_stripped_file.getvalue())) + return json.load(io.StringIO(comment_stripped_file.getvalue())) def find_appropriate_rcfile(options): Index: lldb/utils/test/disasm.py =================================================================== --- lldb/utils/test/disasm.py +++ lldb/utils/test/disasm.py @@ -39,7 +39,7 @@ func, mc, mc_options): - from cStringIO import StringIO + from io import StringIO import pexpect gdb_prompt = "\r\n\(gdb\) " Index: lldb/utils/test/run-until-faulted.py =================================================================== --- lldb/utils/test/run-until-faulted.py +++ lldb/utils/test/run-until-faulted.py @@ -32,7 +32,6 @@ def do_lldb_launch_loop(lldb_command, exe, exe_options): - from cStringIO import StringIO import pexpect import time