about summary refs log tree commit diff
path: root/src/etc
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2025-03-16 09:40:04 +0800
committerGitHub <noreply@github.com>2025-03-16 09:40:04 +0800
commit199e714a665fad0ca663e026e48ad26913379615 (patch)
tree38cf4973b947a93f044761e23fe471115f59eec5 /src/etc
parent8882dac3425e7ecbb2c1aeff7de48eaa830ae1de (diff)
parent69ef2fc908f79d97c6deeee3e2a220688782a62d (diff)
Rollup merge of #137968 - dingxiangfei2009:patch-1, r=Mark-Simulacrum
Properly escape regexes in Python scripts

According to the [Python 3.12 release note](https://docs.python.org/3/whatsnew/3.12.html#other-language-changes) string literals containing typical invalid escape sequences like `"\d"` are now rejected. There seems to remain only two instances of escape sequences in regex. This change will allow us to work with newer Python interpreter.
Diffstat (limited to 'src/etc')
-rw-r--r--src/etc/lldb_batchmode.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/etc/lldb_batchmode.py b/src/etc/lldb_batchmode.py
index cf88c53e085..5cc9bb23628 100644
--- a/src/etc/lldb_batchmode.py
+++ b/src/etc/lldb_batchmode.py
@@ -40,7 +40,7 @@ def print_debug(s):
 
 def normalize_whitespace(s):
     """Replace newlines, tabs, multiple spaces, etc with exactly one space"""
-    return re.sub("\s+", " ", s)
+    return re.sub(r"\s+", " ", s)
 
 
 def breakpoint_callback(frame, bp_loc, dict):
@@ -234,7 +234,7 @@ try:
         if (
             command == "run"
             or command == "r"
-            or re.match("^process\s+launch.*", command)
+            or re.match(r"^process\s+launch.*", command)
         ):
             # Before starting to run the program, let the thread sleep a bit, so all
             # breakpoint added events can be processed