[compiler-rt] 61353cc - [compiler-rt] Fix invalid escape sequences in python files (#94030)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 28 17:32:40 PDT 2024
Author: Eisuke Kawashima
Date: 2024-10-28T17:32:36-07:00
New Revision: 61353cc1f65f02477eedeebcb08e9193cbd53305
URL: https://github.com/llvm/llvm-project/commit/61353cc1f65f02477eedeebcb08e9193cbd53305
DIFF: https://github.com/llvm/llvm-project/commit/61353cc1f65f02477eedeebcb08e9193cbd53305.diff
LOG: [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 <e-kwsm at users.noreply.github.com>
Added:
Modified:
compiler-rt/lib/asan/scripts/asan_symbolize.py
compiler-rt/lib/hwasan/scripts/hwasan_symbolize
Removed:
################################################################################
diff --git a/compiler-rt/lib/asan/scripts/asan_symbolize.py b/compiler-rt/lib/asan/scripts/asan_symbolize.py
index b08769614aeb18..058a1614b55e6a 100755
--- a/compiler-rt/lib/asan/scripts/asan_symbolize.py
+++ b/compiler-rt/lib/asan/scripts/asan_symbolize.py
@@ -316,7 +316,7 @@ def symbolize(self, addr, binary, offset):
# * For C functions atos omits parentheses and argument types.
# * For C++ functions the function name (i.e., `foo` above) may contain
# templates which may contain parentheses.
- match = re.match("^(.*) \(in (.*)\) \((.*:\d*)\)$", atos_line)
+ match = re.match(r"^(.*) \(in (.*)\) \((.*:\d*)\)$", atos_line)
logging.debug("atos_line: %s", atos_line)
if match:
function_name = match.group(1)
@@ -541,7 +541,7 @@ def process_line_posix(self, line):
# names in the regex because it could be an
# Objective-C or C++ demangled name.
stack_trace_line_format = (
- "^( *#([0-9]+) *)(0x[0-9a-f]+) *(?:in *.+)? *\((.*)\+(0x[0-9a-f]+)\)"
+ r"^( *#([0-9]+) *)(0x[0-9a-f]+) *(?:in *.+)? *\((.*)\+(0x[0-9a-f]+)\)"
)
match = re.match(stack_trace_line_format, line)
if not match:
diff --git a/compiler-rt/lib/hwasan/scripts/hwasan_symbolize b/compiler-rt/lib/hwasan/scripts/hwasan_symbolize
index d1b2857ccd8156..efca6b82809b97 100755
--- a/compiler-rt/lib/hwasan/scripts/hwasan_symbolize
+++ b/compiler-rt/lib/hwasan/scripts/hwasan_symbolize
@@ -316,7 +316,7 @@ class Symbolizer:
self.__last_access_tag = int(match.group(2), 16)
def process_tag_dump_line(self, line, ignore_tags=False):
- m = re.match(r'.*?(0x[0-9a-f]+):' + '([ ]*[\[ ][0-9a-f][0-9a-f]\]?)' * 16, line)
+ m = re.match(r'.*?(0x[0-9a-f]+):' + r'([ ]*[\[ ][0-9a-f][0-9a-f]\]?)' * 16, line)
if m is None:
return False
addr = m.group(1)
More information about the llvm-commits
mailing list