Skip to content

Commit d426e3b

Browse files
committed
prepare_report.py: Read/write files in binary mode to preserve line endings on Windows
1 parent aec8fd5 commit d426e3b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/bytecodecompare/prepare_report.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def format_report(self) -> str:
5555

5656

5757
def load_source(path: Union[Path, str]) -> str:
58-
with open(path, mode='r', encoding='utf8') as source_file:
58+
with open(path, mode='rb', encoding='utf8') as source_file:
5959
file_content = source_file.read()
6060

6161
return file_content
@@ -193,7 +193,7 @@ def run_compiler(
193193

194194
# Create a copy that we can use directly with the CLI interface
195195
modified_source_path = tmp_dir / source_file_name.name
196-
with open(modified_source_path, 'w', encoding='utf8') as modified_source_file:
196+
with open(modified_source_path, 'wb', encoding='utf8') as modified_source_file:
197197
modified_source_file.write(compiler_input)
198198

199199
process = subprocess.run(

0 commit comments

Comments
 (0)