Skip to content

Commit 61353cc

Browse files
authored
[compiler-rt] Fix invalid escape sequences in python files (#94030)
\d, \( and \) are not valid escape sequences; since python 3.12 they give SyntaxWarning, and will raise SyntaxError in future. https://docs.python.org/3.12/whatsnew/3.12.html#other-language-changes r"\(\d\)" and "\\(\\d\\)" are equivalent but the former is the shorter. Co-authored-by: Eisuke Kawashima <[email protected]>
1 parent 6233346 commit 61353cc

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

compiler-rt/lib/asan/scripts/asan_symbolize.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def symbolize(self, addr, binary, offset):
316316
# * For C functions atos omits parentheses and argument types.
317317
# * For C++ functions the function name (i.e., `foo` above) may contain
318318
# templates which may contain parentheses.
319-
match = re.match("^(.*) \(in (.*)\) \((.*:\d*)\)$", atos_line)
319+
match = re.match(r"^(.*) \(in (.*)\) \((.*:\d*)\)$", atos_line)
320320
logging.debug("atos_line: %s", atos_line)
321321
if match:
322322
function_name = match.group(1)
@@ -541,7 +541,7 @@ def process_line_posix(self, line):
541541
# names in the regex because it could be an
542542
# Objective-C or C++ demangled name.
543543
stack_trace_line_format = (
544-
"^( *#([0-9]+) *)(0x[0-9a-f]+) *(?:in *.+)? *\((.*)\+(0x[0-9a-f]+)\)"
544+
r"^( *#([0-9]+) *)(0x[0-9a-f]+) *(?:in *.+)? *\((.*)\+(0x[0-9a-f]+)\)"
545545
)
546546
match = re.match(stack_trace_line_format, line)
547547
if not match:

compiler-rt/lib/hwasan/scripts/hwasan_symbolize

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ class Symbolizer:
316316
self.__last_access_tag = int(match.group(2), 16)
317317

318318
def process_tag_dump_line(self, line, ignore_tags=False):
319-
m = re.match(r'.*?(0x[0-9a-f]+):' + '([ ]*[\[ ][0-9a-f][0-9a-f]\]?)' * 16, line)
319+
m = re.match(r'.*?(0x[0-9a-f]+):' + r'([ ]*[\[ ][0-9a-f][0-9a-f]\]?)' * 16, line)
320320
if m is None:
321321
return False
322322
addr = m.group(1)

0 commit comments

Comments
 (0)