[libcxx-commits] [libcxx] Fix missing encoding in open() call in python script (PR #154594)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 20 11:40:42 PDT 2025


https://github.com/siradam7th created https://github.com/llvm/llvm-project/pull/154594

This is a simple fix for the script not being able to run on some platforms due to a missing encoding parameter.

>From 05d8e1e7831acd6f2616cd495b85c61022ae3256 Mon Sep 17 00:00:00 2001
From: siradam7th <siradam7th at users.noreply.github.com>
Date: Wed, 20 Aug 2025 19:29:16 +0100
Subject: [PATCH] fix missing encoding in open() call

---
 libcxx/utils/generate_libcxx_cppm_in.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/libcxx/utils/generate_libcxx_cppm_in.py b/libcxx/utils/generate_libcxx_cppm_in.py
index 39076a61b55b8..26d680a0db31f 100644
--- a/libcxx/utils/generate_libcxx_cppm_in.py
+++ b/libcxx/utils/generate_libcxx_cppm_in.py
@@ -9,11 +9,19 @@
 import os.path
 import sys
 
-from libcxx.header_information import module_c_headers, module_headers, header_restrictions, headers_not_available, libcxx_root
+from libcxx.header_information import (
+    module_c_headers,
+    module_headers,
+    header_restrictions,
+    headers_not_available,
+    libcxx_root,
+)
 
 
 def write_file(module):
-    with open(libcxx_root / "modules" / f"{module}.cppm.in", "w") as module_cpp_in:
+    with open(
+        libcxx_root / "modules" / f"{module}.cppm.in", "w", encoding="utf-8"
+    ) as module_cpp_in:
         module_cpp_in.write(
             """\
 // -*- C++ -*-



More information about the libcxx-commits mailing list