Index: bindings/python/tests/cindex/test_translation_unit.py =================================================================== --- bindings/python/tests/cindex/test_translation_unit.py +++ bindings/python/tests/cindex/test_translation_unit.py @@ -93,10 +93,7 @@ self.assertEqual(spellings[-1], 'y') def test_unsaved_files_2(self): - try: - from StringIO import StringIO - except: - from io import StringIO + from io import StringIO tu = TranslationUnit.from_source('fake.c', unsaved_files = [ ('fake.c', StringIO('int x;'))]) spellings = [c.spelling for c in tu.cursor.get_children()] Index: tools/clang-format/clang-format-diff.py =================================================================== --- tools/clang-format/clang-format-diff.py +++ tools/clang-format/clang-format-diff.py @@ -27,10 +27,7 @@ import re import subprocess import sys -try: - from StringIO import StringIO -except ImportError: - from io import StringIO +from io import StringIO def main(): Index: tools/scan-view/share/ScanView.py =================================================================== --- tools/scan-view/share/ScanView.py +++ tools/scan-view/share/ScanView.py @@ -4,7 +4,9 @@ import sys import urllib, urlparse import posixpath -import StringIO + +from io import StringIO + import re import shutil import threading @@ -105,7 +107,7 @@ except Reporter.ReportFailure as e: self.status = e.value except Exception as e: - s = StringIO.StringIO() + s = StringIO() import traceback print >>s,'Unhandled Exception
'
             traceback.print_exc(e,file=s)
@@ -263,7 +265,7 @@
 
     def handle_exception(self, exc):
         import traceback
-        s = StringIO.StringIO()
+        s = StringIO()
         print >>s, "INTERNAL ERROR\n"
         traceback.print_exc(exc, s)
         f = self.send_string(s.getvalue(), 'text/plain')
@@ -735,7 +737,7 @@
                 mtime = self.dynamic_mtime
             self.send_header("Last-Modified", self.date_time_string(mtime))
             self.end_headers()
-        return StringIO.StringIO(s)
+        return StringIO(s)
 
     def send_patched_file(self, path, ctype):
         # Allow a very limited set of variables. This is pretty gross.