[PATCH] D62882: Use raw strings to avoid deprecation warnings in regexp patterns

Joel E. Denny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 17:38:20 PDT 2019


jdenny added inline comments.


================
Comment at: llvm/trunk/utils/lit/lit/TestRunner.py:1430
                 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 '\\'.
----------------
The `\+` doesn't need the escape here either, right?  While your patch doesn't impact this one, it's another unknown/unnecessary escape at the regex level, similar to the `\'` we discussed.  I'm not a python expert, and I don't know whether it's actually worthwhile to worry about unnecessary escapes at the regex level.

Thanks for the patch, by the way.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62882/new/

https://reviews.llvm.org/D62882





More information about the llvm-commits mailing list