[llvm] 7ed0f5b - [lit] Use raw strings for backslash escapes to fix SyntaxWarnings
Michał Górny via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 20 18:51:27 PDT 2023
Author: Michał Górny
Date: 2023-08-21T03:51:10+02:00
New Revision: 7ed0f5b6de74989c739389770a2d45dc7d58166a
URL: https://github.com/llvm/llvm-project/commit/7ed0f5b6de74989c739389770a2d45dc7d58166a
DIFF: https://github.com/llvm/llvm-project/commit/7ed0f5b6de74989c739389770a2d45dc7d58166a.diff
LOG: [lit] Use raw strings for backslash escapes to fix SyntaxWarnings
Use raw strings instead of regular strings when escapes are used for
regex matches or arbitrary letters rather than C-style characters.
This fixes `SyntaxWarning`s:
```
TestRunner.py:205: SyntaxWarning: invalid escape sequence '\c'
"""
TestRunner.py:1566: SyntaxWarning: invalid escape sequence '\s'
match = _caching_re_compile("^\s*%else\s*(%{)?").search(ln)
```
Differential Revision: https://reviews.llvm.org/D158356
Added:
Modified:
llvm/utils/lit/lit/TestRunner.py
Removed:
################################################################################
diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py
index ed06aaa54d60e2..88755297c8e791 100644
--- a/llvm/utils/lit/lit/TestRunner.py
+++ b/llvm/utils/lit/lit/TestRunner.py
@@ -202,7 +202,7 @@ def expand_glob_expressions(args, cwd):
def quote_windows_command(seq):
- """
+ r"""
Reimplement Python's private subprocess.list2cmdline for MSys compatibility
Based on CPython implementation here:
@@ -1563,7 +1563,7 @@ def tryParseIfCond(ln):
return cond, ln
def tryParseElse(ln):
- match = _caching_re_compile("^\s*%else\s*(%{)?").search(ln)
+ match = _caching_re_compile(r"^\s*%else\s*(%{)?").search(ln)
if not match:
return False, ln
if not match.group(1):
More information about the llvm-commits
mailing list