Skip to content

Commit 199e714

Browse files
authored
Rollup merge of rust-lang#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.
2 parents 8882dac + 69ef2fc commit 199e714

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/etc/lldb_batchmode.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def print_debug(s):
4040

4141
def normalize_whitespace(s):
4242
"""Replace newlines, tabs, multiple spaces, etc with exactly one space"""
43-
return re.sub("\s+", " ", s)
43+
return re.sub(r"\s+", " ", s)
4444

4545

4646
def breakpoint_callback(frame, bp_loc, dict):
@@ -234,7 +234,7 @@ def watchdog():
234234
if (
235235
command == "run"
236236
or command == "r"
237-
or re.match("^process\s+launch.*", command)
237+
or re.match(r"^process\s+launch.*", command)
238238
):
239239
# Before starting to run the program, let the thread sleep a bit, so all
240240
# breakpoint added events can be processed

0 commit comments

Comments
 (0)