Skip to content

Commit 52149b7

Browse files
committed
contrib: Fix clang-format-diff.py lint errors
We assume to be using python3, so don't check for it. This removes a type error on the line `from io import BytesIO as StringIO`. Specify the encoding as "utf8" when opening a file.
1 parent 008e81e commit 52149b7

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

contrib/devtools/clang-format-diff.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@
2929
import subprocess
3030
import sys
3131

32-
if sys.version_info.major >= 3:
33-
from io import StringIO
34-
else:
35-
from io import BytesIO as StringIO
32+
from io import StringIO
3633

3734

3835
def main():
@@ -172,7 +169,7 @@ def main():
172169
sys.exit(p.returncode)
173170

174171
if not args.i:
175-
with open(filename) as f:
172+
with open(filename, encoding="utf8") as f:
176173
code = f.readlines()
177174
formatted_code = StringIO(stdout).readlines()
178175
diff = difflib.unified_diff(

0 commit comments

Comments
 (0)