Running tools/run_perf.py or the presubmit with Python 3.12 prints
"SyntaxWarning: invalid escape sequence" for regexes written as plain
string literals, the same problem crrev.com/c/7580173 fixed in
test/benchmarks/csuite/benchmark.py. Compiling every tracked .py file
with warnings enabled still reports 29 such escapes in 14 files, and
Python has announced that they will eventually become a SyntaxError.
This turns them into raw strings. In sancov_formatter.py the literals
also contained \' so they become double-quoted raw strings, and in
mb_test.py the Windows path only gets its remaining backslashes doubled.
Nothing should change at runtime. I compared the AST of each file
before and after: all string values are identical except four patterns
in v8_presubmit.py where "\n" becomes r"\n", and those compile to the
same regex bytecode. After the change no tracked .py file emits a
SyntaxWarning.
AI tools used
Change-Id: If33347a100847ac0d7506206bf909662b0258524
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8400127
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#109806}