summaryrefslogtreecommitdiffstats
path: root/clang/tools/clang-format/clang-format-diff.py
diff options
context:
space:
mode:
authorSerge Guelton <sguelton@quarkslab.com>2019-01-03 14:26:56 +0000
committerSerge Guelton <sguelton@quarkslab.com>2019-01-03 14:26:56 +0000
commitf886c03e47092d1fad1998df0ddfcffa9e8c3d48 (patch)
tree98f9c815fbac0aea0362bfd246e40b8a54796871 /clang/tools/clang-format/clang-format-diff.py
parentd23e9bc5af0220c049d841acf219e2158f7004b8 (diff)
downloadbcm5719-llvm-f886c03e47092d1fad1998df0ddfcffa9e8c3d48.tar.gz
bcm5719-llvm-f886c03e47092d1fad1998df0ddfcffa9e8c3d48.zip
Portable Python script across Python version
StringIO is obsoleted in Python3, replaced by io.BytesIO or io.StringIO depending on the use. Differential Revision: https://reviews.llvm.org/D55196 llvm-svn: 350318
Diffstat (limited to 'clang/tools/clang-format/clang-format-diff.py')
-rwxr-xr-xclang/tools/clang-format/clang-format-diff.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/tools/clang-format/clang-format-diff.py b/clang/tools/clang-format/clang-format-diff.py
index 54347ce7593..d6d35104161 100755
--- a/clang/tools/clang-format/clang-format-diff.py
+++ b/clang/tools/clang-format/clang-format-diff.py
@@ -28,10 +28,11 @@ import difflib
import re
import subprocess
import sys
-try:
- from StringIO import StringIO
-except ImportError:
- from io import StringIO
+
+if sys.version_info.major >= 3:
+ from io import StringIO
+else:
+ from io import BytesIO as StringIO
def main():
OpenPOWER on IntegriCloud