Skip to content

Commit 7ed0f5b

Browse files
committed
[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
1 parent 14de5a2 commit 7ed0f5b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/utils/lit/lit/TestRunner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def expand_glob_expressions(args, cwd):
202202

203203

204204
def quote_windows_command(seq):
205-
"""
205+
r"""
206206
Reimplement Python's private subprocess.list2cmdline for MSys compatibility
207207
208208
Based on CPython implementation here:
@@ -1563,7 +1563,7 @@ def tryParseIfCond(ln):
15631563
return cond, ln
15641564

15651565
def tryParseElse(ln):
1566-
match = _caching_re_compile("^\s*%else\s*(%{)?").search(ln)
1566+
match = _caching_re_compile(r"^\s*%else\s*(%{)?").search(ln)
15671567
if not match:
15681568
return False, ln
15691569
if not match.group(1):

0 commit comments

Comments
 (0)