Skip to content

Commit 22bf371

Browse files
committed
conformance - use utf-8 in open for Windows support
On Windows it failed with UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 4590: character maps to <undefined>
1 parent 8118ef6 commit 22bf371

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

conformance/src/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def f(): pass # E[final]
6767
{"final": [3, 4]}
6868
)
6969
"""
70-
with open(test_case, "r") as f:
70+
with open(test_case, "r", encoding="utf-8") as f:
7171
lines = f.readlines()
7272
output: dict[int, tuple[int, int]] = {}
7373
groups: dict[str, list[int]] = {}

conformance/src/type_checker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def run_tests(self, test_files: Sequence[str]) -> dict[str, str]:
325325
if not fi.endswith(".py"):
326326
continue
327327
options.tweak(input=fi)
328-
with open(fi, "r") as test_file:
328+
with open(fi, "r", encoding="utf-8") as test_file:
329329
src = test_file.read()
330330
try:
331331
analysis: pytype_analyze.Analysis = pytype_io.check_py(

0 commit comments

Comments
 (0)