[clang] [clang] SyntaxWarning: invalid escape sequence '\s' with Python3.12 (PR #78036)

Jie Fu 傅杰 via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 13 15:19:20 PST 2024


https://github.com/DamonFool updated https://github.com/llvm/llvm-project/pull/78036

>From 57fa67bf86bea09b9c6011b8c9ec6f69fe11852f Mon Sep 17 00:00:00 2001
From: Jie Fu <jiefu at tencent.com>
Date: Sat, 13 Jan 2024 21:51:36 +0800
Subject: [PATCH 1/2] [clang] SyntaxWarning: invalid escape sequence '\s' with
 Python3.12

llvm-project/clang/tools/libclang/linker-script-to-export-list.py:9: SyntaxWarning: invalid escape sequence '\s'
  m = re.search("^\s+(clang_[^;]+)", line)
---
 clang/tools/libclang/linker-script-to-export-list.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/tools/libclang/linker-script-to-export-list.py b/clang/tools/libclang/linker-script-to-export-list.py
index 745996028d835f..35bfa230be704a 100644
--- a/clang/tools/libclang/linker-script-to-export-list.py
+++ b/clang/tools/libclang/linker-script-to-export-list.py
@@ -6,6 +6,6 @@
 output_file = open(sys.argv[2], "w")
 
 for line in input_file:
-    m = re.search("^\s+(clang_[^;]+)", line)
+    m = re.search("^\\s+(clang_[^;]+)", line)
     if m:
         output_file.write(m.group(1) + "\n")

>From 963bbc13fd09fc4ddc918b3e8dcf0b43a27f0b2d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jie=20Fu=20=28=E5=82=85=E6=9D=B0=29?=
 <19923746+DamonFool at users.noreply.github.com>
Date: Sun, 14 Jan 2024 07:19:13 +0800
Subject: [PATCH 2/2] Update
 clang/tools/libclang/linker-script-to-export-list.py

Co-authored-by: cor3ntin <corentinjabot at gmail.com>
---
 clang/tools/libclang/linker-script-to-export-list.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/tools/libclang/linker-script-to-export-list.py b/clang/tools/libclang/linker-script-to-export-list.py
index 35bfa230be704a..9c7b6a98a34b55 100644
--- a/clang/tools/libclang/linker-script-to-export-list.py
+++ b/clang/tools/libclang/linker-script-to-export-list.py
@@ -6,6 +6,6 @@
 output_file = open(sys.argv[2], "w")
 
 for line in input_file:
-    m = re.search("^\\s+(clang_[^;]+)", line)
+    m = re.search(r"^\s+(clang_[^;]+)", line)
     if m:
         output_file.write(m.group(1) + "\n")



More information about the cfe-commits mailing list