Skip to content

Commit c2c1031

Browse files
authored
[Flang][Windows] Fix test_errors.py by enforcing UTF-8 encoding (#134625)
This patch fixes UnicodeDecodeError on Windows in test_errors.py. This issue was observed on the flang-arm64-windows-msvc buildbot. Semantics/OpenMP/interop-construct.f90 was crashing due to Python defaulting to the cp1252 codec on Windows. I have fixed this by explicitly setting encoding="utf-8" when reading source files and invoking subprocess.run() in test_errors.py flang-arm64-windows-msvc was running on stagging master which resulted in this issue not being fixed earlier. https://lab.llvm.org/staging/#/builders/206
1 parent e8dc8ad commit c2c1031

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

flang/test/Semantics/test_errors.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
cm.check_args(sys.argv)
1919
srcdir = cm.set_source(sys.argv[1])
20-
with open(srcdir, "r") as f:
20+
with open(srcdir, "r", encoding="utf-8") as f:
2121
src = f.readlines()
2222
actual = ""
2323
expect = ""
@@ -39,6 +39,7 @@
3939
check=True,
4040
universal_newlines=True,
4141
cwd=tmpdir,
42+
encoding="utf-8",
4243
)
4344
except subprocess.CalledProcessError as e:
4445
log = e.stderr

0 commit comments

Comments
 (0)