[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 06:05:56 PST 2024
https://github.com/DamonFool created https://github.com/llvm/llvm-project/pull/78036
The following SyntaxWarning was observed 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)
```
Similar problem had been reported here https://stackoverflow.com/questions/57645829/why-am-i-getting-a-syntaxwarning-invalid-escape-sequence-s-warning .
It would be better to fix it.
Thanks.
>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] [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")
More information about the cfe-commits
mailing list