[PATCH] D62882: Use raw strings to avoid deprecation warnings in regexp patterns
Adrian McCarthy via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 7 13:36:57 PDT 2019
amccarth updated this revision to Diff 203616.
amccarth added a comment.
Changed the approach in the first fix to use explicit escaping after Joel Denny's comment got me to re-think it.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62882/new/
https://reviews.llvm.org/D62882
Files:
llvm/utils/lit/lit/TestRunner.py
Index: llvm/utils/lit/lit/TestRunner.py
===================================================================
--- llvm/utils/lit/lit/TestRunner.py
+++ llvm/utils/lit/lit/TestRunner.py
@@ -49,7 +49,7 @@
# This regex captures ARG. ARG must not contain a right parenthesis, which
# terminates %dbg. ARG must not contain quotes, in which ARG might be enclosed
# during expansion.
-kPdbgRegex = '%dbg\(([^)\'"]*)\)'
+kPdbgRegex = '%dbg\\(([^)\'"]*)\\)'
class ShellEnvironment(object):
@@ -1420,14 +1420,14 @@
# Trim trailing whitespace.
line = line.rstrip()
# Substitute line number expressions
- line = re.sub('%\(line\)', str(line_number), line)
+ line = re.sub(r'%\(line\)', str(line_number), line)
def replace_line_number(match):
if match.group(1) == '+':
return str(line_number + int(match.group(2)))
if match.group(1) == '-':
return str(line_number - int(match.group(2)))
- line = re.sub('%\(line *([\+-]) *(\d+)\)', replace_line_number, line)
+ line = re.sub(r'%\(line *([\+-]) *(\d+)\)', replace_line_number, line)
# Collapse lines with trailing '\\'.
if output and output[-1][-1] == '\\':
output[-1] = output[-1][:-1] + line
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62882.203616.patch
Type: text/x-patch
Size: 1294 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190607/8500095b/attachment.bin>
More information about the llvm-commits
mailing list