[clang] bf830b0 - Switch to opening the temp file in binary mode

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 3 12:32:32 PST 2019


Author: Aaron Ballman
Date: 2019-12-03T15:31:46-05:00
New Revision: bf830b01a21e6ff2f44c17be4ad4ee897465a677

URL: https://github.com/llvm/llvm-project/commit/bf830b01a21e6ff2f44c17be4ad4ee897465a677
DIFF: https://github.com/llvm/llvm-project/commit/bf830b01a21e6ff2f44c17be4ad4ee897465a677.diff

LOG: Switch to opening the temp file in binary mode

This corrects an issue where the script would write the file with the
incorrect line endings on Windows.

Added: 
    

Modified: 
    clang/test/AST/gen_ast_dump_json_test.py

Removed: 
    


################################################################################
diff  --git a/clang/test/AST/gen_ast_dump_json_test.py b/clang/test/AST/gen_ast_dump_json_test.py
index 87b3318f76cd..f783c79faef8 100644
--- a/clang/test/AST/gen_ast_dump_json_test.py
+++ b/clang/test/AST/gen_ast_dump_json_test.py
@@ -180,7 +180,7 @@ def process_file(source_file, clang_binary, cmdline_filters, cmdline_opts,
         
             filter_json(j, filters, out_asts)
         
-    with tempfile.NamedTemporaryFile("w", delete=False) as f:
+    with tempfile.NamedTemporaryFile("wb", delete=False) as f:
         with open(source_file, "r") as srcf:
             for line in srcf.readlines():
                 # copy up to the note:


        


More information about the cfe-commits mailing list