Skip to content

Commit a1a3e01

Browse files
authored
[cross-project-tests] Fix invalid escape sequences (#94031)
These generate a SyntaxWarning with Python 3.12.
1 parent 5eb9acf commit a1a3e01

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

cross-project-tests/debuginfo-tests/dexter/dex/command/ParseCommand.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def get_address_object(address_name: str, offset: int = 0):
128128

129129

130130
def _search_line_for_cmd_start(line: str, start: int, valid_commands: dict) -> int:
131-
"""Scan `line` for a string matching any key in `valid_commands`.
131+
r"""Scan `line` for a string matching any key in `valid_commands`.
132132
133133
Start searching from `start`.
134134
Commands escaped with `\` (E.g. `\DexLabel('a')`) are ignored.
@@ -543,7 +543,7 @@ def test_parse_share_line(self):
543543
def test_parse_escaped(self):
544544
"""Escaped commands are ignored."""
545545

546-
lines = ['words \MockCmd("IGNORED") words words words\n']
546+
lines = ['words \\MockCmd("IGNORED") words words words\n']
547547

548548
values = self._find_all_mock_values_in_lines(lines)
549549

cross-project-tests/lit.cfg.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def can_target_host():
223223
xcode_lldb_vers = subprocess.check_output(["xcrun", "lldb", "--version"]).decode(
224224
"utf-8"
225225
)
226-
match = re.search("lldb-(\d+)", xcode_lldb_vers)
226+
match = re.search(r"lldb-(\d+)", xcode_lldb_vers)
227227
if match:
228228
apple_lldb_vers = int(match.group(1))
229229
if apple_lldb_vers < 1000:
@@ -247,7 +247,7 @@ def get_gdb_version_string():
247247
if len(gdb_vers_lines) < 1:
248248
print("Unkown GDB version format (too few lines)", file=sys.stderr)
249249
return None
250-
match = re.search("GNU gdb \(.*?\) ((\d|\.)+)", gdb_vers_lines[0].strip())
250+
match = re.search(r"GNU gdb \(.*?\) ((\d|\.)+)", gdb_vers_lines[0].strip())
251251
if match is None:
252252
print(f"Unkown GDB version format: {gdb_vers_lines[0]}", file=sys.stderr)
253253
return None
@@ -261,7 +261,7 @@ def get_clang_default_dwarf_version_string(triple):
261261
# Get the flags passed by the driver and look for -dwarf-version.
262262
cmd = f'{llvm_config.use_llvm_tool("clang")} -g -xc -c - -v -### --target={triple}'
263263
stderr = subprocess.run(cmd.split(), stderr=subprocess.PIPE).stderr.decode()
264-
match = re.search("-dwarf-version=(\d+)", stderr)
264+
match = re.search(r"-dwarf-version=(\d+)", stderr)
265265
if match is None:
266266
print("Cannot determine default dwarf version", file=sys.stderr)
267267
return None

0 commit comments

Comments
 (0)