[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 14:09:34 PDT 2019


amccarth marked 3 inline comments as done.
amccarth added inline comments.


================
Comment at: llvm/utils/lit/lit/TestRunner.py:52
 # during expansion.
-kPdbgRegex = '%dbg\(([^)\'"]*)\)'
+kPdbgRegex = r'%dbg\(([^)\'"]*)\)'
 
----------------
amccarth wrote:
> jdenny wrote:
> > The fact that `\'` will remain as `\'` bugs me because the `'` need not be escaped as part of the regex.  Hopefully that won't be deprecated one day.
> Would you prefer the following?
> 
>     kPdbgRegex = '%dbg\\(([^)\'"]*)\\)'
> 
> (It's kind of disappointing the Python raw string literals aren't always the best choice.)
I've gone ahead and switched this to a non-raw string and just added the extra escaping.


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

https://reviews.llvm.org/D62882





More information about the llvm-commits mailing list